From cbcb7579c3227acf56b1ed72e8cc47bdb655fa9f Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 24 Jan 2015 01:18:32 -0800 Subject: [PATCH] INFRA-132 - Misc --- Civi/Angular/Page/Main.php | 1 + api/v3/RelationshipType.php | 2 +- .../CRM/Core/BAO/ActionScheduleTest.php | 82 +++++++++++-------- .../CRM/Core/Resources/StringsTest.php | 3 +- tests/phpunit/CRM/Utils/HTMLTest.php | 3 +- tests/phpunit/Civi/Angular/ManagerTest.php | 3 +- 6 files changed, 57 insertions(+), 37 deletions(-) diff --git a/Civi/Angular/Page/Main.php b/Civi/Angular/Page/Main.php index 35c098a104..e8e2994f86 100644 --- a/Civi/Angular/Page/Main.php +++ b/Civi/Angular/Page/Main.php @@ -85,4 +85,5 @@ class Main extends \CRM_Core_Page { } } } + } diff --git a/api/v3/RelationshipType.php b/api/v3/RelationshipType.php index dc8da5a358..bb04607350 100644 --- a/api/v3/RelationshipType.php +++ b/api/v3/RelationshipType.php @@ -124,4 +124,4 @@ function _civicrm_api3_relationship_type_getlist_defaults($request) { 'label_field' => 'label_a_b', 'search_field' => 'label_a_b', ); -} \ No newline at end of file +} diff --git a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php index 6cf39e5e67..3ff7705a1b 100755 --- a/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php +++ b/tests/phpunit/CRM/Core/BAO/ActionScheduleTest.php @@ -206,7 +206,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'week', 'subject' => 'subject sched_membership_end_2week', ); - $this->fixtures['sched_on_membership_end_date'] = array( // create() + $this->fixtures['sched_on_membership_end_date'] = array( 'name' => 'sched_on_membership_end_date', 'title' => 'sched_on_membership_end_date', 'body_html' => '

Your membership expired today

', @@ -220,7 +220,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'start_action_unit' => 'hour', 'subject' => 'subject send reminder on membership_end_date', ); - $this->fixtures['sched_after_1day_membership_end_date'] = array( // create() + $this->fixtures['sched_after_1day_membership_end_date'] = array( 'name' => 'sched_after_1day_membership_end_date', 'title' => 'sched_after_1day_membership_end_date', 'body_html' => '

Your membership expired yesterday

', @@ -728,22 +728,21 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $result = $this->callAPISuccess('Email', 'create', array( 'is_primary' => 1, 'contact_id' => $membership->contact_id, - 'email' => 'member2@example.com' + 'email' => 'member2@example.com', )); $this->assertAPISuccess($result); // end_date=2012-09-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-08-31 01:00:00', 'recipients' => array(), - ), - /* TODO - array( // After the 2-week mark, send an email - 'time' => '2012-09-01 01:00:00', - 'recipients' => array(array('member2@example.com')), - ), - */ + ), + //array( // After the 2-week mark, send an email + //'time' => '2012-09-01 01:00:00', + //'recipients' => array(array('member2@example.com')), + //), )); } @@ -899,7 +898,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { )); } - function testMembership_referenceDate() { + public function testMembership_referenceDate() { $membership = $this->createTestObject('CRM_Member_DAO_Membership', array_merge($this->fixtures['rolling_membership'], array('status_id' => 2))); $this->assertTrue(is_numeric($membership->id)); @@ -918,11 +917,13 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { // start_date=2012-03-15 ; schedule is 2 weeks after start_date $this->assertCronRuns(array( - array( // After the 2-week mark, send an email + array( + // After the 2-week mark, send an email 'time' => '2012-03-29 01:00:00', 'recipients' => array(array('member@example.com')), ), - array( // After the 2-week 1day mark, don't send an email + array( + // After the 2-week 1day mark, don't send an email 'time' => '2012-03-30 01:00:00', 'recipients' => array(), ), @@ -939,13 +940,15 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $membership->save(); $this->assertCronRuns(array( - array( // After the 13 days of the changed join date 2012-03-29, don't send an email + array( + // After the 13 days of the changed join date 2012-03-29, don't send an email 'time' => '2012-04-11 01:00:00', - 'recipients' => array() - ), - array( // After the 2-week of the changed join date 2012-03-29, send an email + 'recipients' => array(), + ), + array( + // After the 2-week of the changed join date 2012-03-29, send an email 'time' => '2012-04-12 01:00:00', - 'recipients' => array(array('member@example.com')) + 'recipients' => array(array('member@example.com')), ), )); @@ -963,7 +966,7 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { 'contact_id' => $membership->contact_id, 'email' => 'member@example.com', )); - $result = $this->callAPISuccess('contact', 'create', array_merge($this->fixtures['contact'], array('contact_id' => $membership->contact_id))); + $result = $this->callAPISuccess('contact', 'create', array_merge($this->fixtures['contact'], array('contact_id' => $membership->contact_id))); $this->assertAPISuccess($result); $actionScheduleBefore = $this->fixtures['sched_membership_end_2week']; // Send email 2 weeks before end_date @@ -977,31 +980,38 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $this->assertCronRuns( array( - array( // 1day 2weeks before membership end date(MED), don't send mail + array( + // 1day 2weeks before membership end date(MED), don't send mail 'time' => '2012-05-31 01:00:00', 'recipients' => array(), ), - array( // 2 weeks before MED, send an email + array( + // 2 weeks before MED, send an email 'time' => '2012-06-01 01:00:00', 'recipients' => array(array('member@example.com')), ), - array( // 1day before MED, don't send mail + array( + // 1day before MED, don't send mail 'time' => '2012-06-14 01:00:00', 'recipients' => array(), ), - array( // On MED, send an email + array( + // On MED, send an email 'time' => '2012-06-15 00:00:00', 'recipients' => array(array('member@example.com')), ), - array( // After 1day of MED, send an email + array( + // After 1day of MED, send an email 'time' => '2012-06-16 01:00:00', 'recipients' => array(array('member@example.com')), ), - array( // After 1day 1min of MED, don't send an email + array( + // After 1day 1min of MED, don't send an email 'time' => '2012-06-17 00:01:00', 'recipients' => array(), ), - )); + ) + ); // Assert the timestamp as of when the emails of respective three reminders as configured // 2 weeks before, on and 1 day after MED, are sent @@ -1020,27 +1030,33 @@ class CRM_Core_BAO_ActionScheduleTest extends CiviUnitTestCase { $result = $this->callAPISuccess('Contact', 'get', array('id' => $membership->contact_id)); $this->assertCronRuns( array( - array( // 1day 2weeks before membership end date(MED), don't send mail + array( + // 1day 2weeks before membership end date(MED), don't send mail 'time' => '2012-06-05 01:00:00', 'recipients' => array(), ), - array( // 2 weeks before MED, send an email + array( + // 2 weeks before MED, send an email 'time' => '2012-06-06 01:00:00', 'recipients' => array(array('member@example.com')), ), - array( // 1day before MED, don't send mail + array( + // 1day before MED, don't send mail 'time' => '2012-06-19 01:00:00', 'recipients' => array(), ), - array( // On MED, send an email + array( + // On MED, send an email 'time' => '2012-06-20 00:00:00', 'recipients' => array(array('member@example.com')), ), - array( // After 1day of MED, send an email + array( + // After 1day of MED, send an email 'time' => '2012-06-21 01:00:00', 'recipients' => array(array('member@example.com')), ), - array( // After 1day 1min of MED, don't send an email + array( + // After 1day 1min of MED, don't send an email 'time' => '2012-07-21 00:01:00', 'recipients' => array(), ), diff --git a/tests/phpunit/CRM/Core/Resources/StringsTest.php b/tests/phpunit/CRM/Core/Resources/StringsTest.php index 730c2c992b..0b44276ec0 100644 --- a/tests/phpunit/CRM/Core/Resources/StringsTest.php +++ b/tests/phpunit/CRM/Core/Resources/StringsTest.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ require_once 'CiviTest/CiviUnitTestCase.php'; @@ -60,4 +60,5 @@ class CRM_Core_Resources_StringsTest extends CiviUnitTestCase { file_put_contents("$basedir/hello.html", "
{{ts('Hello from HTML')}}
"); return $basedir; } + } diff --git a/tests/phpunit/CRM/Utils/HTMLTest.php b/tests/phpunit/CRM/Utils/HTMLTest.php index 7e24fa9046..0af328ec23 100644 --- a/tests/phpunit/CRM/Utils/HTMLTest.php +++ b/tests/phpunit/CRM/Utils/HTMLTest.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ require_once 'CiviTest/CiviUnitTestCase.php'; @@ -122,4 +122,5 @@ class CRM_Utils_HTMLTest extends CiviUnitTestCase { sort($actualStrings); $this->assertEquals($expectedStrings, $actualStrings); } + } diff --git a/tests/phpunit/Civi/Angular/ManagerTest.php b/tests/phpunit/Civi/Angular/ManagerTest.php index 230cc98e91..ce3a4f730d 100644 --- a/tests/phpunit/Civi/Angular/ManagerTest.php +++ b/tests/phpunit/Civi/Angular/ManagerTest.php @@ -23,7 +23,7 @@ | GNU Affero General Public License or the licensing of CiviCRM, | | see the CiviCRM license FAQ at http://civicrm.org/licensing | +--------------------------------------------------------------------+ -*/ + */ namespace Civi\Angular; @@ -115,4 +115,5 @@ class ManagerTest extends \CiviUnitTestCase { $this->assertTrue(in_array('Save Draft', $strings)); // If crmMailing changes, feel free to use a different example. } + } -- 2.25.1