Skip to content
Snippets Groups Projects
Commit 1200e498 authored by Kurund Jalmi's avatar Kurund Jalmi
Browse files

Merge pull request #1384 from yashodha/4.4.CRM-10138

fix notice for failing test(CRM-10138)
parents 56ca7e7f ef170fe0
Branches
Tags
No related merge requests found
......@@ -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);
......
......@@ -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(
......
......@@ -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'],
);
......
......@@ -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 ----------
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment