From ef170fe01ece231a9891d6adb536ad79225850f5 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 8 Aug 2013 19:06:00 +0530 Subject: [PATCH] fix notice for failing test(CRM-10138) --- api/v3/MailingEventUnsubscribe.php | 5 ++-- tests/phpunit/api/v3/MailingContactTest.php | 1 + tests/phpunit/api/v3/MailingGroupTest.php | 32 +++++++++++++-------- tests/phpunit/api/v3/MailingTest.php | 13 ++++----- 4 files changed, 29 insertions(+), 22 deletions(-) diff --git a/api/v3/MailingEventUnsubscribe.php b/api/v3/MailingEventUnsubscribe.php index efdee308cc..53a624bcc3 100644 --- a/api/v3/MailingEventUnsubscribe.php +++ b/api/v3/MailingEventUnsubscribe.php @@ -49,16 +49,15 @@ */ function civicrm_api3_mailing_event_unsubscribe_create($params) { - $job = $params['job_id']; + $job = $params['job_id']; $queue = $params['event_queue_id']; - $hash = $params['hash']; + $hash = $params['hash']; if (empty($params['org_unsubscribe'])) { $groups = CRM_Mailing_Event_BAO_Unsubscribe::unsub_from_mailing($job, $queue, $hash); if (count($groups)) { CRM_Mailing_Event_BAO_Unsubscribe::send_unsub_response($queue, $groups, FALSE, $job); return civicrm_api3_create_success($params); } - if (!groups) {} } else { $unsubs = CRM_Mailing_Event_BAO_Unsubscribe::unsub_from_domain($job, $queue, $hash); diff --git a/tests/phpunit/api/v3/MailingContactTest.php b/tests/phpunit/api/v3/MailingContactTest.php index ed6736d290..08d79b2eaf 100644 --- a/tests/phpunit/api/v3/MailingContactTest.php +++ b/tests/phpunit/api/v3/MailingContactTest.php @@ -39,6 +39,7 @@ require_once 'CiviTest/CiviUnitTestCase.php'; class api_v3_MailingContactTest extends CiviUnitTestCase { protected $_apiversion = 3; protected $_entity = 'mailing'; + function setUp() { parent::setUp(); $params = array( diff --git a/tests/phpunit/api/v3/MailingGroupTest.php b/tests/phpunit/api/v3/MailingGroupTest.php index c971a32070..335b39e3f0 100644 --- a/tests/phpunit/api/v3/MailingGroupTest.php +++ b/tests/phpunit/api/v3/MailingGroupTest.php @@ -36,7 +36,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { protected $_groupID; protected $_email; protected $_apiversion; - public $_eNoticeCompliant = FALSE; + public $_eNoticeCompliant = TRUE; + function get_info() { return array( 'name' => 'Mailer Group', @@ -48,8 +49,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { function setUp() { parent::setUp(); $this->_apiversion = 3; - $this->_groupID = $this->groupCreate(NULL); - $this->_email = 'test@test.test'; + $this->_groupID = $this->groupCreate(NULL); + $this->_email = 'test@test.test'; } function tearDown() { @@ -65,7 +66,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { $params = array( 'email' => $this->_email, 'group_id' => 'Wrong Group ID', - 'contact_id' => '2121', 'time_stamp' => '20111111010101', + 'contact_id' => '2121', + 'time_stamp' => '20111111010101', 'hash' => 'sasa', ); $result = $this->callAPIFailure('mailing_event_subscribe', 'create', $params); @@ -85,7 +87,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { 'first_name' => 'Test', 'last_name' => 'Test', 'email' => $this->_email, - 'contact_type' => 'Individual', ); + 'contact_type' => 'Individual', + ); $contactID = $this->individualCreate($params); $params = array( @@ -110,7 +113,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { $params = array( 'job_id' => 'Wrong ID', 'event_queue_id' => 'Wrong ID', - 'hash' => 'Wrong Hash', 'time_stamp' => '20101212121212', + 'hash' => 'Wrong Hash', + 'time_stamp' => '20101212121212', ); $result = $this->callAPIFailure('mailing_event_unsubscribe', 'create', $params); @@ -127,14 +131,14 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { 'job_id' => 'Wrong ID', 'event_queue_id' => 'Wrong ID', 'hash' => 'Wrong Hash', - 'org_unsubscribe' => 1, 'time_stamp' => '20101212121212', + 'org_unsubscribe' => 1, + 'time_stamp' => '20101212121212', ); $result = $this->callAPIFailure('mailing_event_unsubscribe', 'create', $params); $this->assertEquals($result['error_message'], 'Domain Queue event could not be found', 'In line ' . __LINE__); } - //----------- civicrm_mailing_group_event_resubscribe methods-------- /** @@ -149,7 +153,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { 'job_id' => 'Wrong ID', 'event_queue_id' => 'Wrong ID', 'hash' => 'Wrong Hash', - 'org_unsubscribe' => 'test', 'time_stamp' => '20101212121212', + 'org_unsubscribe' => 'test', + 'time_stamp' => '20101212121212', ); $result = $this->callAPIFailure('mailing_event_resubscribe', 'create', $params); $this->assertEquals($result['error_message'], 'Queue event could not be found', 'In line ' . __LINE__); @@ -165,13 +170,15 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { 'first_name' => 'Test', 'last_name' => 'Test', 'email' => $this->_email, - 'contact_type' => 'Individual', ); + 'contact_type' => 'Individual', + ); $contactID = $this->individualCreate($params); $params = array( 'email' => $this->_email, 'group_id' => $this->_groupID, - 'contact_id' => $contactID, 'hash' => 'b15de8b64e2cec34', + 'contact_id' => $contactID, + 'hash' => 'b15de8b64e2cec34', 'time_stamp' => '20101212121212', ); $result = $this->callAPISuccess('mailing_event_subscribe', 'create', $params); @@ -181,7 +188,8 @@ class api_v3_MailingGroupTest extends CiviUnitTestCase { $params = array( 'contact_id' => $result['values'][$result['id']]['contact_id'], 'subscribe_id' => $result['values'][$result['id']]['subscribe_id'], - 'hash' => $result['values'][$result['id']]['hash'], 'time_stamp' => '20101212121212', + 'hash' => $result['values'][$result['id']]['hash'], + 'time_stamp' => '20101212121212', 'event_subscribe_id' => $result['values'][$result['id']]['subscribe_id'], ); diff --git a/tests/phpunit/api/v3/MailingTest.php b/tests/phpunit/api/v3/MailingTest.php index 8d4a63101b..846dfcc5ed 100644 --- a/tests/phpunit/api/v3/MailingTest.php +++ b/tests/phpunit/api/v3/MailingTest.php @@ -49,8 +49,8 @@ class api_v3_MailingTest extends CiviUnitTestCase { function setUp() { parent::setUp(); - $this->_groupID = $this->groupCreate(NULL); - $this->_email = 'test@test.test'; + $this->_groupID = $this->groupCreate(NULL); + $this->_email = 'test@test.test'; $this->_params = array( 'subject' => 'maild', 'body_text' => 'bdkfhdskfhduew', @@ -70,7 +70,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { $result = $this->callAPIAndDocument('mailing', 'create', $this->_params, __FUNCTION__, __FILE__); $jobs = $this->callAPISuccess('mailing_job', 'get', array('mailing_id' => $result['id'])); $this->assertEquals(1, $jobs['count']); - unset($this->_params['created_id']);// return isn't working on this in getAndCheck so lets not check it for now + unset($this->_params['created_id']); // return isn't working on this in getAndCheck so lets not check it for now $this->getAndCheck($this->_params, $result['id'], 'mailing'); } @@ -121,7 +121,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { 'hash' => 'Wrong Hash', 'event_subscribe_id' => '123', 'time_stamp' => '20111111010101', - ); + ); $result = $this->callAPIFailure('mailing_event', 'confirm', $params, 'Confirmation failed' ); @@ -144,7 +144,7 @@ class api_v3_MailingTest extends CiviUnitTestCase { 'bodyTxt' => 'Body...', 'replyTo' => $this->_email, 'time_stamp' => '20111111010101', - ); + ); $result = $this->callAPIFailure('mailing_event', 'reply', $params, 'Queue event could not be found' ); @@ -166,13 +166,12 @@ class api_v3_MailingTest extends CiviUnitTestCase { 'hash' => 'Wrong Hash', 'email' => $this->_email, 'time_stamp' => '20111111010101', - ); + ); $result = $this->callAPIFailure('mailing_event', 'forward', $params, 'Queue event could not be found' ); } - //----------- civicrm_mailing_create ---------- } -- 2.25.1