Use SubscriberEntity constants in tests

[MAILPOET-6115]
This commit is contained in:
David Remer
2024-06-21 08:47:04 +03:00
committed by Veljko V
parent db62990c0c
commit a24922a0d2

View File

@@ -164,7 +164,7 @@ class AbandonedCartTest extends \MailPoetTest {
public function testItSchedulesAbandonedCartAlsoForNonSubscribedSubscribers() { public function testItSchedulesAbandonedCartAlsoForNonSubscribedSubscribers() {
$this->createNewsletter(); $this->createNewsletter();
$this->createSubscriberAsCurrentUser('unconfirmed'); $this->createSubscriberAsCurrentUser(SubscriberEntity::STATUS_UNCONFIRMED);
$this->wooCommerceCartMock->method('is_empty')->willReturn(false); $this->wooCommerceCartMock->method('is_empty')->willReturn(false);
$abandonedCartEmail = $this->createAbandonedCartEmail(); $abandonedCartEmail = $this->createAbandonedCartEmail();
@@ -359,14 +359,14 @@ class AbandonedCartTest extends \MailPoetTest {
return $scheduledTask; return $scheduledTask;
} }
private function createSubscriber(string $status = 'subscribed'): SubscriberEntity { private function createSubscriber(string $status = SubscriberEntity::STATUS_SUBSCRIBED): SubscriberEntity {
return (new SubscriberFactory()) return (new SubscriberFactory())
->withWpUserId(123) ->withWpUserId(123)
->withStatus($status) ->withStatus($status)
->create(); ->create();
} }
private function createSubscriberAsCurrentUser(string $status = 'subscribed'): SubscriberEntity { private function createSubscriberAsCurrentUser(string $status = SubscriberEntity::STATUS_SUBSCRIBED): SubscriberEntity {
$subscriber = $this->createSubscriber($status); $subscriber = $this->createSubscriber($status);
$this->wp->method('wpGetCurrentUser')->willReturn( $this->wp->method('wpGetCurrentUser')->willReturn(
$this->makeEmpty(WP_User::class, [ $this->makeEmpty(WP_User::class, [