Rebased master
This commit is contained in:
@@ -378,7 +378,7 @@ class APITest extends \MailPoetTest {
|
|||||||
expect($result['name'])->equals($segment['name']);
|
expect($result['name'])->equals($segment['name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItDoesNotUnsubscribeMissingSusbcriberFromLists() {
|
function testItDoesNotUnsubscribeMissingSubscriberFromLists() {
|
||||||
try {
|
try {
|
||||||
API::MP(self::VERSION)->unsubscribeFromLists(false, array(1,2,3));
|
API::MP(self::VERSION)->unsubscribeFromLists(false, array(1,2,3));
|
||||||
$this->fail('Subscriber does not exist exception should have been thrown.');
|
$this->fail('Subscriber does not exist exception should have been thrown.');
|
||||||
@@ -494,6 +494,32 @@ class APITest extends \MailPoetTest {
|
|||||||
expect($result['subscriptions'][0]['status'])->equals(Subscriber::STATUS_UNSUBSCRIBED);
|
expect($result['subscriptions'][0]['status'])->equals(Subscriber::STATUS_UNSUBSCRIBED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testItGetsSubscriber() {
|
||||||
|
$subscriber = Subscriber::create();
|
||||||
|
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
||||||
|
$subscriber->save();
|
||||||
|
$segment = Segment::createOrUpdate(
|
||||||
|
array(
|
||||||
|
'name' => 'Default',
|
||||||
|
'type' => Segment::TYPE_DEFAULT
|
||||||
|
)
|
||||||
|
);
|
||||||
|
API::MP(self::VERSION)->subscribeToList($subscriber->id, $segment->id);
|
||||||
|
|
||||||
|
// successful response
|
||||||
|
$result = API::MP(self::VERSION)->getSubscriber($subscriber->email);
|
||||||
|
expect($result['email'])->equals($subscriber->email);
|
||||||
|
expect($result['subscriptions'][0]['segment_id'])->equals($segment->id);
|
||||||
|
|
||||||
|
// error response
|
||||||
|
try {
|
||||||
|
API::MP(self::VERSION)->getSubscriber('some_fake_email');
|
||||||
|
$this->fail('Subscriber does not exist exception should have been thrown.');
|
||||||
|
} catch(\Exception $e) {
|
||||||
|
expect($e->getMessage())->equals('This subscriber does not exist.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _after() {
|
function _after() {
|
||||||
\ORM::raw_execute('TRUNCATE ' . Subscriber::$_table);
|
\ORM::raw_execute('TRUNCATE ' . Subscriber::$_table);
|
||||||
\ORM::raw_execute('TRUNCATE ' . CustomField::$_table);
|
\ORM::raw_execute('TRUNCATE ' . CustomField::$_table);
|
||||||
|
Reference in New Issue
Block a user