diff --git a/mailpoet/tests/integration/API/MP/APITest.php b/mailpoet/tests/integration/API/MP/APITest.php index 4b97cd3c44..f64a65f028 100644 --- a/mailpoet/tests/integration/API/MP/APITest.php +++ b/mailpoet/tests/integration/API/MP/APITest.php @@ -116,24 +116,6 @@ class APITest extends \MailPoetTest { ); } - public function testItGetsSubscriber() { - $subscriber = $this->subscriberFactory->create(); - $segment = $this->getSegment(); - $this->getApi()->subscribeToList($subscriber->getId(), $segment->getId()); - - // successful response - $result = $this->getApi()->getSubscriber($subscriber->getEmail()); - expect($result['email'])->equals($subscriber->getEmail()); - expect($result['subscriptions'][0]['segment_id'])->equals($segment->getId()); - - // error response - try { - $this->getApi()->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.'); - } - } public function _after() { $this->truncateEntity(SubscriberEntity::class); diff --git a/mailpoet/tests/integration/API/MP/SubscribersTest.php b/mailpoet/tests/integration/API/MP/SubscribersTest.php index e8e47f4e31..500ae8471f 100644 --- a/mailpoet/tests/integration/API/MP/SubscribersTest.php +++ b/mailpoet/tests/integration/API/MP/SubscribersTest.php @@ -6,6 +6,7 @@ use Codeception\Stub; use Codeception\Stub\Expected; use MailPoet\API\JSON\ResponseBuilders\SubscribersResponseBuilder; use MailPoet\API\MP\v1\API; +use MailPoet\API\MP\v1\APIException; use MailPoet\API\MP\v1\CustomFields; use MailPoet\API\MP\v1\Segments; use MailPoet\API\MP\v1\Subscribers; @@ -704,6 +705,22 @@ class SubscribersTest extends \MailPoetTest { $API->addSubscriber($subscriber, $segments, $options); } + public function testItGetsSubscriber() { + $subscriber = $this->subscriberFactory->create(); + $segment = $this->getSegment(); + $this->getApi()->subscribeToList($subscriber->getId(), $segment->getId()); + + $result = $this->getApi()->getSubscriber($subscriber->getEmail()); + expect($result['email'])->equals($subscriber->getEmail()); + expect($result['subscriptions'][0]['segment_id'])->equals($segment->getId()); + } + + public function testGetSubscriberThrowsWhenSubscriberDoesntExist() { + $this->expectException(APIException::class); + $this->expectExceptionMessage('This subscriber does not exist.'); + $this->getApi()->getSubscriber('some_fake_email'); + } + public function _after() { $this->truncateEntity(SubscriberEntity::class); $this->truncateEntity(SegmentEntity::class);