Display subscribers with correct status

[MAILPOET-1944]
This commit is contained in:
Pavel Dohnal
2019-04-23 16:50:49 +02:00
committed by M. Shull
parent 7b61df02e5
commit ae70f7ae9b
4 changed files with 50 additions and 7 deletions

View File

@ -322,6 +322,30 @@ class SubscribersTest extends \MailPoetTest {
);
}
function testItCorrectSubscriptionStatus() {
$segment = Segment::createOrUpdate(array('name' => 'Segment185245'));
$subscriber = Subscriber::createOrUpdate([
'email' => 'third@example.com',
'status' => Subscriber::STATUS_SUBSCRIBED,
'segments' => array(
$segment->id,
),
'source' => Source::API,
]);
SubscriberSegment::createOrUpdate([
'subscriber_id' => $subscriber->id,
'segment_id' => $segment->id,
'status' => Subscriber::STATUS_UNSUBSCRIBED,
]);
$response = $this->endpoint->listing([
'filter' => [
'segment' => $segment->id,
],
]);
expect($response->data[0]['status'])->equals(Subscriber::STATUS_UNSUBSCRIBED);
}
function testItCanSortAndLimitListing() {
// get 1st page (limit items per page to 1)
$response = $this->endpoint->listing(array(