Remove phpstan-ignores from tests
[MAILPOET-3235]
This commit is contained in:
@ -28,10 +28,11 @@ class AbandonedCartPageVisitTrackerTest extends \MailPoetTest {
|
|||||||
$this->currentTime = Carbon::now();
|
$this->currentTime = Carbon::now();
|
||||||
Carbon::setTestNow($this->currentTime);
|
Carbon::setTestNow($this->currentTime);
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
/** @var WPFunctions|MockObject $wp - for phpstan*/
|
||||||
$this->wp = $this->makeEmpty(WPFunctions::class, [
|
$wp = $this->makeEmpty(WPFunctions::class, [
|
||||||
'currentTime' => $this->currentTime->getTimestamp(),
|
'currentTime' => $this->currentTime->getTimestamp(),
|
||||||
]);
|
]);
|
||||||
|
$this->wp = $wp;
|
||||||
|
|
||||||
$wooCommerceMock = $this->mockWooCommerceClass(WooCommerce::class, []);
|
$wooCommerceMock = $this->mockWooCommerceClass(WooCommerce::class, []);
|
||||||
$wooCommerceMock->session = $this->createWooCommerceSessionMock();
|
$wooCommerceMock->session = $this->createWooCommerceSessionMock();
|
||||||
|
@ -49,8 +49,8 @@ class AbandonedCartTest extends \MailPoetTest {
|
|||||||
$this->currentTime = Carbon::createFromTimestamp((new WPFunctions())->currentTime('timestamp'));
|
$this->currentTime = Carbon::createFromTimestamp((new WPFunctions())->currentTime('timestamp'));
|
||||||
Carbon::setTestNow($this->currentTime);
|
Carbon::setTestNow($this->currentTime);
|
||||||
|
|
||||||
// @phpstan-ignore-next-line
|
/** @var WPFunctions|MockObject $wp - for phpstan */
|
||||||
$this->wp = $this->makeEmpty(WPFunctions::class, [
|
$wp = $this->makeEmpty(WPFunctions::class, [
|
||||||
'currentTime' => function ($arg) {
|
'currentTime' => function ($arg) {
|
||||||
if ($arg === 'timestamp') {
|
if ($arg === 'timestamp') {
|
||||||
return $this->currentTime->getTimestamp();
|
return $this->currentTime->getTimestamp();
|
||||||
@ -59,18 +59,21 @@ class AbandonedCartTest extends \MailPoetTest {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
$this->wp = $wp;
|
||||||
WPFunctions::set($this->wp);
|
WPFunctions::set($this->wp);
|
||||||
|
|
||||||
$this->wooCommerceMock = $this->mockWooCommerceClass(WooCommerce::class, []);
|
$this->wooCommerceMock = $this->mockWooCommerceClass(WooCommerce::class, []);
|
||||||
$this->wooCommerceCartMock = $this->mockWooCommerceClass(WC_Cart::class, ['is_empty', 'get_cart']);
|
$this->wooCommerceCartMock = $this->mockWooCommerceClass(WC_Cart::class, ['is_empty', 'get_cart']);
|
||||||
$this->wooCommerceMock->cart = $this->wooCommerceCartMock;
|
$this->wooCommerceMock->cart = $this->wooCommerceCartMock;
|
||||||
// @phpstan-ignore-next-line
|
/** @var WooCommerceHelper|MockObject $wooCommerceHelperMock - for phpstan */
|
||||||
$this->wooCommerceHelperMock = $this->make(WooCommerceHelper::class, [
|
$wooCommerceHelperMock = $this->make(WooCommerceHelper::class, [
|
||||||
'isWooCommerceActive' => true,
|
'isWooCommerceActive' => true,
|
||||||
'WC' => $this->wooCommerceMock,
|
'WC' => $this->wooCommerceMock,
|
||||||
]);
|
]);
|
||||||
// @phpstan-ignore-next-line
|
$this->wooCommerceHelperMock = $wooCommerceHelperMock;
|
||||||
$this->pageVisitTrackerMock = $this->makeEmpty(AbandonedCartPageVisitTracker::class);
|
/** @var AbandonedCartPageVisitTracker|MockObject $pageVisitTrackerMock - for phpstan */
|
||||||
|
$pageVisitTrackerMock = $this->makeEmpty(AbandonedCartPageVisitTracker::class);
|
||||||
|
$this->pageVisitTrackerMock = $pageVisitTrackerMock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItGetsEventDetails() {
|
public function testItGetsEventDetails() {
|
||||||
|
@ -17,7 +17,7 @@ class DatabaseTest extends \MailPoetTest {
|
|||||||
|
|
||||||
public function _before() {
|
public function _before() {
|
||||||
parent::_before();
|
parent::_before();
|
||||||
ORM::set_db(null); // @phpstan-ignore-line
|
ORM::reset_db();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItDefinesTables() {
|
public function testItDefinesTables() {
|
||||||
|
@ -66,7 +66,7 @@ class ShortcodesTest extends \MailPoetTest {
|
|||||||
expect((new WPFunctions)->isUserLoggedIn())->true();
|
expect((new WPFunctions)->isUserLoggedIn())->true();
|
||||||
$subscriber = Subscriber::create();
|
$subscriber = Subscriber::create();
|
||||||
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
||||||
$subscriber->email = $wpUser->data->user_email; // @phpstan-ignore-line
|
$subscriber->email = $wpUser->user_email; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
$subscriber->wpUserId = $wpUser->ID;
|
$subscriber->wpUserId = $wpUser->ID;
|
||||||
$subscriber->save();
|
$subscriber->save();
|
||||||
|
|
||||||
@ -83,7 +83,7 @@ class ShortcodesTest extends \MailPoetTest {
|
|||||||
expect($wp->isUserLoggedIn())->true();
|
expect($wp->isUserLoggedIn())->true();
|
||||||
$subscriber = Subscriber::create();
|
$subscriber = Subscriber::create();
|
||||||
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
||||||
$subscriber->email = $wpUser->data->user_email; // @phpstan-ignore-line
|
$subscriber->email = $wpUser->user_email; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
$subscriber->wpUserId = $wpUser->ID;
|
$subscriber->wpUserId = $wpUser->ID;
|
||||||
$subscriber->save();
|
$subscriber->save();
|
||||||
|
|
||||||
@ -102,7 +102,7 @@ class ShortcodesTest extends \MailPoetTest {
|
|||||||
public function testItDoesNotDisplayManageSubscriptionFormForLoggedinNonexistentSubscribers() {
|
public function testItDoesNotDisplayManageSubscriptionFormForLoggedinNonexistentSubscribers() {
|
||||||
$wpUser = wp_set_current_user(1);
|
$wpUser = wp_set_current_user(1);
|
||||||
expect((new WPFunctions)->isUserLoggedIn())->true();
|
expect((new WPFunctions)->isUserLoggedIn())->true();
|
||||||
expect(Subscriber::findOne($wpUser->data->user_email))->false(); // @phpstan-ignore-line
|
expect(Subscriber::findOne($wpUser->user_email))->false(); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
|
|
||||||
$shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class);
|
$shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class);
|
||||||
$shortcodes->init();
|
$shortcodes->init();
|
||||||
@ -125,7 +125,7 @@ class ShortcodesTest extends \MailPoetTest {
|
|||||||
expect((new WPFunctions)->isUserLoggedIn())->true();
|
expect((new WPFunctions)->isUserLoggedIn())->true();
|
||||||
$subscriber = Subscriber::create();
|
$subscriber = Subscriber::create();
|
||||||
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
$subscriber->hydrate(Fixtures::get('subscriber_template'));
|
||||||
$subscriber->email = $wpUser->data->user_email; // @phpstan-ignore-line
|
$subscriber->email = $wpUser->user_email; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
$subscriber->wpUserId = $wpUser->ID;
|
$subscriber->wpUserId = $wpUser->ID;
|
||||||
$subscriber->save();
|
$subscriber->save();
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ class ShortcodesTest extends \MailPoetTest {
|
|||||||
public function testItDoesNotDisplayLinkToManageSubscriptionPageForLoggedinNonexistentSubscribers() {
|
public function testItDoesNotDisplayLinkToManageSubscriptionPageForLoggedinNonexistentSubscribers() {
|
||||||
$wpUser = wp_set_current_user(1);
|
$wpUser = wp_set_current_user(1);
|
||||||
expect((new WPFunctions)->isUserLoggedIn())->true();
|
expect((new WPFunctions)->isUserLoggedIn())->true();
|
||||||
expect(Subscriber::findOne($wpUser->data->user_email))->false(); // @phpstan-ignore-line
|
expect(Subscriber::findOne($wpUser->user_email))->false(); // phpcs:ignore Squiz.NamingConventions.ValidVariableName.NotCamelCaps
|
||||||
|
|
||||||
$shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class);
|
$shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class);
|
||||||
$shortcodes->init();
|
$shortcodes->init();
|
||||||
|
Reference in New Issue
Block a user