- Updates total subscriber count to exclude trashed records
- Updates unit test
This commit is contained in:
@@ -648,7 +648,9 @@ class Subscriber extends Model {
|
||||
return self::whereIn('status', array(
|
||||
self::STATUS_SUBSCRIBED,
|
||||
self::STATUS_UNCONFIRMED
|
||||
))->count();
|
||||
))
|
||||
->whereNull('deleted_at')
|
||||
->count();
|
||||
}
|
||||
|
||||
static function bulkTrash($orm) {
|
||||
|
@@ -465,6 +465,12 @@ class SubscriberTest extends MailPoetTest {
|
||||
'status' => Subscriber::STATUS_UNSUBSCRIBED
|
||||
));
|
||||
|
||||
$subscriber_4 = Subscriber::createOrUpdate(array(
|
||||
'email' => 'subscriber_4@mailpoet.com',
|
||||
'status' => Subscriber::STATUS_SUBSCRIBED,
|
||||
'deleted_at' => Carbon::now()->toDateTimeString()
|
||||
));
|
||||
|
||||
// counts only subscribed & unconfirmed users
|
||||
$total = Subscriber::getTotalSubscribers();
|
||||
expect($total)->equals(2);
|
||||
|
Reference in New Issue
Block a user