From c41e5c7d0f4cdafa2d4e315fb4aa214c486a7030 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Wed, 18 Oct 2023 16:31:15 -0300 Subject: [PATCH] Replace expect()->hasNotKey() with verify()->arrayHasNotKey() codeception/verify 2.1 removed support for expect()->hasNotKey() so we need to replace it with verify()->arrayHasNotKey(). [MAILPOET-5664] --- mailpoet/tests/integration/API/JSON/v1/SettingsTest.php | 2 +- .../integration/AutomaticEmails/AutomaticEmailsTest.php | 2 +- .../AutomaticEmails/WooCommerce/WooCommerceTest.php | 4 ++-- .../tests/integration/Doctrine/ConnectionFactoryTest.php | 2 +- mailpoet/tests/integration/WooCommerce/TrackerTest.php | 6 +++--- mailpoet/tests/unit/CustomFields/ApiDataSanitizerTest.php | 4 ++-- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php b/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php index 3c185daa60..7662aba125 100644 --- a/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php @@ -128,7 +128,7 @@ class SettingsTest extends \MailPoetTest { $response = $this->endpoint->get(); verify($response->status)->equals(APIResponse::STATUS_OK); - expect($response->data['some']['setting'])->hasNotKey('key'); + verify($response->data['some']['setting'])->arrayHasNotKey('key'); verify($response->data['some']['setting']['new_key'])->true(); verify($response->data['some']['new_setting'])->true(); } diff --git a/mailpoet/tests/integration/AutomaticEmails/AutomaticEmailsTest.php b/mailpoet/tests/integration/AutomaticEmails/AutomaticEmailsTest.php index d652283f1a..7d0a31316d 100644 --- a/mailpoet/tests/integration/AutomaticEmails/AutomaticEmailsTest.php +++ b/mailpoet/tests/integration/AutomaticEmails/AutomaticEmailsTest.php @@ -86,7 +86,7 @@ class AutomaticEmailsTest extends \MailPoetTest { $result = $this->AM->getAutomaticEmails(); verify($result)->arrayHasKey('email1'); - expect($result)->hasNotKey('email2'); + verify($result)->arrayHasNotKey('email2'); $this->wp->removeAllFilters('mailpoet_automatic_email_test1'); $this->wp->removeAllFilters('mailpoet_automatic_email_test2'); diff --git a/mailpoet/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php b/mailpoet/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php index 395a3633ab..5b1267bba9 100644 --- a/mailpoet/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php +++ b/mailpoet/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php @@ -96,8 +96,8 @@ class WooCommerceTest extends \MailPoetTest { $AM = new AutomaticEmails(new WPFunctions(), $this->automaticEmailFactory); $result = $AM->getAutomaticEmailBySlug('woocommerce'); foreach ($result['events'] as $event) { - expect($event)->hasNotKey('actionButtonTitle'); - expect($event)->hasNotKey('actionButtonLink'); + verify($event)->arrayHasNotKey('actionButtonTitle'); + verify($event)->arrayHasNotKey('actionButtonLink'); } } diff --git a/mailpoet/tests/integration/Doctrine/ConnectionFactoryTest.php b/mailpoet/tests/integration/Doctrine/ConnectionFactoryTest.php index b729926df5..5466d6e461 100644 --- a/mailpoet/tests/integration/Doctrine/ConnectionFactoryTest.php +++ b/mailpoet/tests/integration/Doctrine/ConnectionFactoryTest.php @@ -60,7 +60,7 @@ class ConnectionFactoryTest extends \MailPoetTest { Env::$dbCharset = ''; $connectionFactory = new ConnectionFactory(); $connection = $connectionFactory->createConnection(); - expect($connection->getParams())->hasNotKey('charset'); + verify($connection->getParams())->arrayHasNotKey('charset'); } public function testItSetsUpSocket() { diff --git a/mailpoet/tests/integration/WooCommerce/TrackerTest.php b/mailpoet/tests/integration/WooCommerce/TrackerTest.php index bff642169d..5fedc98415 100644 --- a/mailpoet/tests/integration/WooCommerce/TrackerTest.php +++ b/mailpoet/tests/integration/WooCommerce/TrackerTest.php @@ -148,8 +148,8 @@ class TrackerTest extends \MailPoetTest { verify($mailPoetData['campaign_' . $notificationParent->getId() . '_type'])->equals($notificationParent->getType()); verify($mailPoetData['campaign_' . $notificationParent->getId() . '_orders_count'])->equals(2); - expect($mailPoetData)->hasNotKey('campaign_' . $notificationHistory1->getId() . '_revenue'); - expect($mailPoetData)->hasNotKey('campaign_' . $notificationHistory2->getId() . '_revenue'); + verify($mailPoetData)->arrayHasNotKey('campaign_' . $notificationHistory1->getId() . '_revenue'); + verify($mailPoetData)->arrayHasNotKey('campaign_' . $notificationHistory2->getId() . '_revenue'); } public function testItTracksOnlyTheMainShopCurrency(): void { @@ -189,7 +189,7 @@ class TrackerTest extends \MailPoetTest { verify($mailPoetData['campaign_' . $newsletter2->getId() . '_type'])->equals($newsletter2->getType()); verify($mailPoetData['campaign_' . $newsletter2->getId() . '_orders_count'])->equals(1); - expect($mailPoetData)->hasNotKey('campaign_' . $newsletter3->getId() . '_revenue'); + verify($mailPoetData)->arrayHasNotKey('campaign_' . $newsletter3->getId() . '_revenue'); } public function testItTracksTheRevenueOfDeletedCampaigns(): void { diff --git a/mailpoet/tests/unit/CustomFields/ApiDataSanitizerTest.php b/mailpoet/tests/unit/CustomFields/ApiDataSanitizerTest.php index 4f910195b7..12bb5ed351 100644 --- a/mailpoet/tests/unit/CustomFields/ApiDataSanitizerTest.php +++ b/mailpoet/tests/unit/CustomFields/ApiDataSanitizerTest.php @@ -72,7 +72,7 @@ class ApiDataSanitizerTest extends \MailPoetUnitTest { public function testItIgnoresUnknownProperties() { $result = $this->sanitizer->sanitize(['name' => 'Name', 'type' => 'text', 'unknown' => 'Unknown property']); - expect($result)->hasNotKey('unknown'); + verify($result)->arrayHasNotKey('unknown'); } public function testItReturnsParamsIfPassed() { @@ -90,7 +90,7 @@ class ApiDataSanitizerTest extends \MailPoetUnitTest { public function testItIgnoresUnknownParams() { $result = $this->sanitizer->sanitize(['name' => 'Name', 'type' => 'text', 'params' => ['unknown' => 'Unknown property']]); verify($result)->arrayHasKey('params'); - expect($result['params'])->hasNotKey('unknown'); + verify($result['params'])->arrayHasNotKey('unknown'); } public function testItFillsLabel() {