Skip to content

Commit

Permalink
Merge pull request #10044 from eileenmcnaughton/4.7.18rc
Browse files Browse the repository at this point in the history
Minor test tidy up.
  • Loading branch information
eileenmcnaughton authored Mar 24, 2017
2 parents c587c71 + 62e5719 commit 1af2328
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions tests/phpunit/api/v3/JobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ class api_v3_JobTest extends CiviUnitTestCase {
*/
public $membershipTypeID;

/**
* Set up for tests.
*/
public function setUp() {
parent::setUp();
$this->membershipTypeID = $this->membershipTypeCreate(array('name' => 'General'));
Expand Down Expand Up @@ -118,21 +121,6 @@ public function testCreate() {
$this->assertDBState('CRM_Core_DAO_Job', $result['id'], $this->_params);
}

/**
* Check with empty array.
*/
public function testDeleteEmpty() {
$params = array();
$result = $this->callAPIFailure('job', 'delete', $params);
}

/**
* Check with No array.
*/
public function testDeleteParamsNotArray() {
$result = $this->callAPIFailure('job', 'delete', 'string');
}

/**
* Check if required fields are not passed.
*/
Expand All @@ -154,7 +142,7 @@ public function testDeleteWithIncorrectData() {
$params = array(
'id' => 'abcd',
);
$result = $this->callAPIFailure('job', 'delete', $params);
$this->callAPIFailure('job', 'delete', $params);
}

/**
Expand All @@ -163,7 +151,7 @@ public function testDeleteWithIncorrectData() {
public function testDelete() {
$createResult = $this->callAPISuccess('job', 'create', $this->_params);
$params = array('id' => $createResult['id']);
$result = $this->callAPIAndDocument('job', 'delete', $params, __FUNCTION__, __FILE__);
$this->callAPIAndDocument('job', 'delete', $params, __FUNCTION__, __FILE__);
$this->assertAPIDeleted($this->_entity, $createResult['id']);
}

Expand All @@ -182,7 +170,7 @@ public function testDelete() {
* Note that this test is about tesing the metadata / calling of the function & doesn't test the success of the called function
*/
public function testCallUpdateGreetingSuccess() {
$result = $this->callAPISuccess($this->_entity, 'update_greeting', array(
$this->callAPISuccess($this->_entity, 'update_greeting', array(
'gt' => 'postal_greeting',
'ct' => 'Individual',
));
Expand All @@ -191,7 +179,7 @@ public function testCallUpdateGreetingSuccess() {
public function testCallUpdateGreetingCommaSeparatedParamsSuccess() {
$gt = 'postal_greeting,email_greeting,addressee';
$ct = 'Individual,Household';
$result = $this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => $gt, 'ct' => $ct));
$this->callAPISuccess($this->_entity, 'update_greeting', array('gt' => $gt, 'ct' => $ct));
}

/**
Expand All @@ -211,7 +199,7 @@ public function testCallSendReminderSuccessMoreThanDefaultLimit() {
for ($i = 1; $i <= $createTotal; $i++) {
$contactID = $this->individualCreate();
$groupID = $this->groupCreate(array('name' => $i, 'title' => $i));
$result = $this->callAPISuccess('action_schedule', 'create', array(
$this->callAPISuccess('action_schedule', 'create', array(
'title' => " job $i",
'subject' => "job $i",
'entity_value' => $membershipTypeID,
Expand All @@ -229,7 +217,7 @@ public function testCallSendReminderSuccessMoreThanDefaultLimit() {
'group_id' => $groupID,
));
}
$result = $this->callAPISuccess('job', 'send_reminder', array());
$this->callAPISuccess('job', 'send_reminder', array());
$successfulCronCount = CRM_Core_DAO::singleValueQuery("SELECT count(*) FROM civicrm_action_log");
$this->assertEquals($successfulCronCount, $createTotal);
}
Expand Down

0 comments on commit 1af2328

Please sign in to comment.