From 92c99a4a4320708b8fa2fa6575c66357d69f8bb9 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 15 Jan 2015 20:48:02 +1300 Subject: [PATCH] comment fixes --- tests/phpunit/CRM/Contact/BAO/ContactTest.php | 21 +++--- .../CRM/Core/BAO/ActionScheduleTest.php | 64 ++++++++++++------- tests/phpunit/api/v3/ContributionTest.php | 11 ++-- .../phpunit/api/v3/SyntaxConformanceTest.php | 2 +- 4 files changed, 60 insertions(+), 38 deletions(-) diff --git a/tests/phpunit/CRM/Contact/BAO/ContactTest.php b/tests/phpunit/CRM/Contact/BAO/ContactTest.php index 8e8b9d07b9..19860615f9 100644 --- a/tests/phpunit/CRM/Contact/BAO/ContactTest.php +++ b/tests/phpunit/CRM/Contact/BAO/ContactTest.php @@ -285,8 +285,9 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { } /** - * Test case for create( ) - * test with missing params. + * Test case for create. + * + * Test with missing params. */ public function testCreateWithEmptyParams() { $params = array( @@ -300,8 +301,9 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { } /** - * Test case for create( ) - * test with all params. + * Test case for create. + * + * Test with all params. * ( create and update modes ). */ public function testCreateWithAll() { @@ -1159,7 +1161,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { } /** - * Test case for getPrimaryEmail( ) + * Test case for getPrimaryEmail. */ public function testGetPrimaryEmail() { //get the contact params @@ -1454,7 +1456,7 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { /** * Ensure that civicrm_contact.modified_date is updated when manipulating an email. */ - public function testTimestamps_phone() { + public function testTimestampsPhone() { $test = $this; $this->_testTimestamps(array( 'INSERT' => function ($contactId) use ($test) { @@ -1486,10 +1488,11 @@ class CRM_Contact_BAO_ContactTest extends CiviUnitTestCase { } /** - * Ensure that civicrm_contact.modified_date is updated when contact-related - * custom data + * Ensure that civicrm_contact.modified_date is updated correctly. + * + * Looking at it when contact-related custom data is updated. */ - public function testTimestamps_custom() { + public function testTimestampsCustom() { $customGroup = Custom::createGroup(array(), 'Individual'); $this->assertNotNull($customGroup); $fields = array( diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 8c06c18aff..c37c52a490 100644 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -418,6 +418,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * Tears down the fixture, for example, closes a network connection. + * * This method is called after a test is executed. */ public function tearDown() { @@ -426,11 +427,16 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $this->mut->clearMessages(); $this->mut->stop(); unset($this->mut); - $this->quickCleanup(array('civicrm_action_schedule', 'civicrm_action_log', 'civicrm_membership', 'civicrm_email')); + $this->quickCleanup(array( + 'civicrm_action_schedule', + 'civicrm_action_log', + 'civicrm_membership', + 'civicrm_email', + )); $this->_tearDown(); } - public function testActivityDateTime_Match_NonRepeatableSchedule() { + public function testActivityDateTimeMatchNonRepeatableSchedule() { $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day']); $this->assertTrue(is_numeric($actionScheduleDao->id)); @@ -464,7 +470,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { )); } - public function testActivityDateTime_Match_RepeatableSchedule() { + public function testActivityDateTimeMatchRepeatableSchedule() { $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($this->fixtures['sched_activity_1day_r']); $this->assertTrue(is_numeric($actionScheduleDao->id)); @@ -513,7 +519,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * For contacts/members which match schedule based on join date, * an email should be sent. */ - public function testMembershipJoinDate_Match() { + public function testMembershipJoinDateMatch() { $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 1))); $this->assertTrue(is_numeric($membership->id)); $result = $this->callAPISuccess('Email', 'create', array( @@ -550,7 +556,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * For contacts/members which match schedule based on join date, * an email should be sent. */ - public function testMembershipJoinDate_NonMatch() { + public function testMembershipJoinDateNonMatch() { $membership = $this->createTestObject('CRM_Member_DAO_Membership', $this->fixtures['rolling_membership']); $this->assertTrue(is_numeric($membership->id)); $result = $this->callAPISuccess('Email', 'create', array( @@ -580,7 +586,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * Test that the first and SECOND notifications are sent out. */ - public function testMembershipEndDate_Repeat() { + public function testMembershipEndDateRepeat() { // creates membership with end_date = 20120615 $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2))); $result = $this->callAPISuccess('Email', 'create', array( @@ -615,7 +621,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * between * see CRM-15376 */ - public function testMembershipEndDate_Repeat_ChangedEndDate_CRM_15376() { + public function testMembershipEndDateRepeatChangedEndDate_CRM_15376() { // creates membership with end_date = 20120615 $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2))); $this->callAPISuccess('Email', 'create', array( @@ -653,7 +659,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * For contacts/members which match schedule based on end date, * an email should be sent. */ - public function testMembershipEndDate_Match() { + public function testMembershipEndDateMatch() { // creates membership with end_date = 20120615 $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2))); $this->assertTrue(is_numeric($membership->id)); @@ -692,7 +698,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { * For contacts/members which match schedule based on end date, * an email should be sent. */ - public function testMembershipEndDate_NoMatch() { + public function testMembershipEndDateNoMatch() { // creates membership with end_date = 20120615 $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership_past'], array('status_id' => 3))); $this->assertTrue(is_numeric($membership->id)); @@ -724,7 +730,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { )); } - public function testContactBirthDate_noAnniv() { + public function testContactBirthDateNoAnniv() { $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']); $this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id']; $actionSchedule = $this->fixtures['sched_contact_bday_yesterday']; @@ -744,25 +750,27 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { )); } - public function testContactBirthDate_Anniversary() { + public function testContactBirthDateAnniversary() { $contact = $this->callAPISuccess('Contact', 'create', $this->fixtures['contact_birthdate']); $this->_testObjects['CRM_Contact_DAO_Contact'][] = $contact['id']; $actionSchedule = $this->fixtures['sched_contact_bday_anniv']; $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule); $this->assertTrue(is_numeric($actionScheduleDao->id)); $this->assertCronRuns(array( - array(// On some random day, no email + array( + // On some random day, no email. 'time' => '2014-03-07 01:00:00', 'recipients' => array(), ), - array(// On the eve of their 9th birthday, send an email + array( + // On the eve of their 9th birthday, send an email. 'time' => '2014-07-06 20:00:00', 'recipients' => array(array('test-bday@example.com')), ), )); } - public function testContactCustomDate_noAnniv() { + public function testContactCustomDateNoAnniv() { $group = array( 'title' => 'Test_Group', 'name' => 'test_group', @@ -788,11 +796,13 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule); $this->assertTrue(is_numeric($actionScheduleDao->id)); $this->assertCronRuns(array( - array(// On some random day, no email + array( + // On some random day, no email. 'time' => '2014-03-07 01:00:00', 'recipients' => array(), ), - array(// On the eve of their graduation, send an email + array( + // On the eve of their graduation, send an email. 'time' => '2013-12-15 20:00:00', 'recipients' => array(array('test-member@example.com')), ), @@ -801,7 +811,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { } /** - * Check that limit_to + an empty recipients doesn't sent to multiple contacts + * Check that limit_to + an empty recipients doesn't sent to multiple contacts. */ public function testMembershipLimitToNone() { // creates membership with end_date = 20120615 @@ -824,7 +834,8 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // end_date=2012-06-15 ; schedule is 2 weeks before end_date $this->assertCronRuns(array( - array(// Before the 2-week mark, no email + array( + // Before the 2-week mark, no email. 'time' => '2012-05-31 01:00:00', // 'time' => '2012-06-01 01:00:00', // FIXME: Is this the right boundary? 'recipients' => array(), @@ -833,7 +844,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { } - public function testContactCustomDate_Anniv() { + public function testContactCustomDateAnniv() { $group = array( 'title' => 'Test_Group now', 'name' => 'test_group_now', @@ -860,11 +871,13 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $actionScheduleDao = CRM_Core_BAO_ActionSchedule::add($actionSchedule); $this->assertTrue(is_numeric($actionScheduleDao->id)); $this->assertCronRuns(array( - array(// On some random day, no email + array( + // On some random day, no email. 'time' => '2014-03-07 01:00:00', 'recipients' => array(), ), - array(// A week after their 5th anniversary of graduation, send an email + array( + // A week after their 5th anniversary of graduation, send an email. 'time' => '2018-12-23 20:00:00', 'recipients' => array(array('test-member@example.com')), ), @@ -879,7 +892,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // TODO // function testEventNameEndDate_Match() { } /** - * Run a series of cron jobs and make an assertion about email deliveries + * Run a series of cron jobs and make an assertion about email deliveries. * * @param array $cronRuns * array specifying when to run cron and what messages to expect; each item is an array with keys: @@ -902,6 +915,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * Sets up the fixture, for example, opens a network connection. + * * This method is called before a test is executed. */ protected function _setUp() { @@ -910,6 +924,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * Tears down the fixture, for example, closes a network connection. + * * This method is called after a test is executed. */ protected function _tearDown() { @@ -919,13 +934,16 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { /** * This is a wrapper for CRM_Core_DAO::createTestObject which tracks - * created entities and provides for brainless clenaup. + * created entities and provides for brainless cleanup. * * @see CRM_Core_DAO::createTestObject + * * @param $daoName * @param array $params * @param int $numObjects * @param bool $createOnly + * + * @return array|NULL|object */ function createTestObject($daoName, $params = array(), $numObjects = 1, $createOnly = FALSE) { $objects = CRM_Core_DAO::createTestObject($daoName, $params, $numObjects, $createOnly); diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 264f0bd5bb..1998571d63 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -702,7 +702,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } /** - * Test using example code. + * Test using example code. */ public function testContributionCreateExample() { //make sure at least on page exists since there is a truncate in tear down @@ -822,8 +822,9 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } /** - * Function tests that additional financial records are created when online contribution with pay later option - * is created + * Tests that additional financial records are created. + * + * Checks when online contribution with pay later option is created */ public function testCreateContributionPayLaterOnline() { CRM_Financial_BAO_PaymentProcessor::create($this->_processorParams); @@ -887,7 +888,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { } /** - * Test that BAO defaults work + * Test that BAO defaults work. */ public function testCreateBAODefaults() { unset($this->_params['contribution_source_id'], $this->_params['payment_instrument_id']); @@ -1152,7 +1153,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->assertEquals($contribution['values'][$contributionID]['contact_id'], $this->_individualId); $this->assertEquals($contribution['values'][$contributionID]['total_amount'], 110.00); - $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'],$this->_financialTypeId ); + $this->assertEquals($contribution['values'][$contributionID]['financial_type_id'],$this->_financialTypeId); $this->assertEquals($contribution['values'][$contributionID]['instrument_id'], $old_payment_instrument); $this->assertEquals($contribution['values'][$contributionID]['non_deductible_amount'], 10.00); $this->assertEquals($contribution['values'][$contributionID]['fee_amount'], $old_fee_amount); diff --git a/tests/phpunit/api/v3/SyntaxConformanceTest.php b/tests/phpunit/api/v3/SyntaxConformanceTest.php index 2fe3a5c0e5..fa1146ff65 100644 --- a/tests/phpunit/api/v3/SyntaxConformanceTest.php +++ b/tests/phpunit/api/v3/SyntaxConformanceTest.php @@ -317,7 +317,7 @@ class api_v3_SyntaxConformanceTest extends CiviUnitTestCase { 'Domain', 'Profile', 'CustomValue', - 'Setting' + 'Setting', ); if ($sequential === TRUE) { return $entitiesWithout; -- 2.25.1