diff --git a/tests/integration/API/JSON/v1/NewslettersTest.php b/tests/integration/API/JSON/v1/NewslettersTest.php index 4d170a0c0c..c6aac3c5b7 100644 --- a/tests/integration/API/JSON/v1/NewslettersTest.php +++ b/tests/integration/API/JSON/v1/NewslettersTest.php @@ -168,7 +168,7 @@ class NewslettersTest extends \MailPoetTest { ); $hookName = 'mailpoet_api_newsletters_get_after'; expect(WPHooksHelper::isFilterApplied($hookName))->true(); - expect(WPHooksHelper::getFilterApplied($hookName)[0])->internalType('array'); + expect(WPHooksHelper::getFilterApplied($hookName)[0])->array(); } public function testItCanSaveANewsletter() { @@ -670,7 +670,7 @@ class NewslettersTest extends \MailPoetTest { ]); $response = $this->endpoint->showPreview($data); - expect($response->meta['preview_url'])->notContains('http'); + expect($response->meta['preview_url'])->stringNotContainsString('http'); expect($response->meta['preview_url'])->regExp('!^\/\/!'); } diff --git a/tests/integration/API/JSON/v1/ServicesTest.php b/tests/integration/API/JSON/v1/ServicesTest.php index a08c3289f5..6f29bd69de 100644 --- a/tests/integration/API/JSON/v1/ServicesTest.php +++ b/tests/integration/API/JSON/v1/ServicesTest.php @@ -81,7 +81,7 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkMSSKey($this->data); expect($response->status)->equals(APIResponse::STATUS_OK); expect($response->data['message']) - ->contains($date->format($servicesEndpoint->dateTime->getDateFormat())); + ->stringContainsString($date->format($servicesEndpoint->dateTime->getDateFormat())); } public function testItRespondsWithErrorIfServiceIsUnavailableDuringMSSCheck() { @@ -96,7 +96,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkMSSKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains( + expect($response->errors[0]['message'])->stringContainsString( $this->invokeMethod( $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNAVAILABLE] ) @@ -115,7 +115,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkMSSKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains( + expect($response->errors[0]['message'])->stringContainsString( $this->invokeMethod( $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNKNOWN] ) @@ -134,7 +134,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkMSSKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains('404'); + expect($response->errors[0]['message'])->stringContainsString('404'); } public function testItRespondsWithErrorIfMSSCheckThrowsAnException() { @@ -291,7 +291,7 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkPremiumKey($this->data); expect($response->status)->equals(APIResponse::STATUS_OK); expect($response->data['message']) - ->contains($date->format($servicesEndpoint->dateTime->getDateFormat())); + ->stringContainsString($date->format($servicesEndpoint->dateTime->getDateFormat())); } public function testItRespondsWithErrorIfServiceIsUnavailableDuringPremiumCheck() { @@ -306,7 +306,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkPremiumKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains( + expect($response->errors[0]['message'])->stringContainsString( $this->invokeMethod( $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNAVAILABLE] ) @@ -325,7 +325,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkPremiumKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains( + expect($response->errors[0]['message'])->stringContainsString( $this->invokeMethod( $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNKNOWN] ) @@ -344,7 +344,7 @@ class ServicesTest extends \MailPoetTest { $servicesEndpoint = $this->createServicesEndpointWithMocks(['bridge' => $bridge]); $response = $servicesEndpoint->checkPremiumKey($this->data); expect($response->status)->equals(APIResponse::STATUS_NOT_FOUND); - expect($response->errors[0]['message'])->contains('404'); + expect($response->errors[0]['message'])->stringContainsString('404'); } public function testItRespondsWithErrorIfPremiumCheckThrowsAnException() { diff --git a/tests/integration/API/JSON/v1/SettingsTest.php b/tests/integration/API/JSON/v1/SettingsTest.php index cb6c305297..d3e99e31d9 100644 --- a/tests/integration/API/JSON/v1/SettingsTest.php +++ b/tests/integration/API/JSON/v1/SettingsTest.php @@ -82,7 +82,7 @@ class SettingsTest extends \MailPoetTest { $response = $this->endpoint->get(); expect($response->status)->equals(APIResponse::STATUS_OK); - expect($response->data['some']['setting'])->hasntKey('key'); + expect($response->data['some']['setting'])->hasNotKey('key'); expect($response->data['some']['setting']['new_key'])->true(); expect($response->data['some']['new_setting'])->true(); } diff --git a/tests/integration/API/JSON/v1/SubscribersTest.php b/tests/integration/API/JSON/v1/SubscribersTest.php index 0778a9b7f5..e6626d7ee1 100644 --- a/tests/integration/API/JSON/v1/SubscribersTest.php +++ b/tests/integration/API/JSON/v1/SubscribersTest.php @@ -532,7 +532,7 @@ class SubscribersTest extends \MailPoetTest { ]); } catch (UnexpectedValueException $exception) { expect($exception->getHttpStatusCode())->equals(APIResponse::STATUS_BAD_REQUEST); - expect($exception->getErrors()[Error::BAD_REQUEST])->contains('Invalid bulk action'); + expect($exception->getErrors()[Error::BAD_REQUEST])->stringContainsString('Invalid bulk action'); } } diff --git a/tests/integration/API/MP/APITest.php b/tests/integration/API/MP/APITest.php index d8f56caf22..155b043f56 100644 --- a/tests/integration/API/MP/APITest.php +++ b/tests/integration/API/MP/APITest.php @@ -453,9 +453,9 @@ class APITest extends \MailPoetTest { $this->getApi()->addSubscriber($subscriber); $this->fail('Failed to add subscriber exception should have been thrown.'); } catch (\Exception $e) { - expect($e->getMessage())->contains('Failed to add subscriber:'); + expect($e->getMessage())->stringContainsString('Failed to add subscriber:'); // error message (converted to lowercase) returned by the model - expect($e->getMessage())->contains('your email address is invalid!'); + expect($e->getMessage())->stringContainsString('your email address is invalid!'); } } diff --git a/tests/integration/AutomaticEmails/AutomaticEmailsTest.php b/tests/integration/AutomaticEmails/AutomaticEmailsTest.php index 15d3e25719..cfa3990d18 100644 --- a/tests/integration/AutomaticEmails/AutomaticEmailsTest.php +++ b/tests/integration/AutomaticEmails/AutomaticEmailsTest.php @@ -81,7 +81,7 @@ class AutomaticEmailsTest extends \MailPoetTest { $result = $this->AM->getAutomaticEmails(); expect($result)->hasKey('email1'); - expect($result)->hasntKey('email2'); + expect($result)->hasNotKey('email2'); $this->wp->removeAllFilters('mailpoet_automatic_email_test1'); $this->wp->removeAllFilters('mailpoet_automatic_email_test2'); diff --git a/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php b/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php index 6ca9fb38e6..055437b8c0 100644 --- a/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php +++ b/tests/integration/AutomaticEmails/WooCommerce/WooCommerceTest.php @@ -82,8 +82,8 @@ class WooCommerceTest extends \MailPoetTest { $AM = new AutomaticEmails(); $result = $AM->getAutomaticEmailBySlug('woocommerce'); foreach ($result['events'] as $event) { - expect($event)->hasntKey('actionButtonTitle'); - expect($event)->hasntKey('actionButtonLink'); + expect($event)->hasNotKey('actionButtonTitle'); + expect($event)->hasNotKey('actionButtonLink'); } } diff --git a/tests/integration/Config/MigratorTest.php b/tests/integration/Config/MigratorTest.php index a06cd8596a..644db2ae4e 100644 --- a/tests/integration/Config/MigratorTest.php +++ b/tests/integration/Config/MigratorTest.php @@ -15,7 +15,7 @@ class MigratorTest extends \MailPoetTest { public function testItCanGenerateTheSubscribersSql() { $subscriberSql = $this->migrator->subscribers(); $expectedTable = $this->migrator->prefix . 'subscribers'; - expect($subscriberSql)->contains($expectedTable); + expect($subscriberSql)->stringContainsString($expectedTable); } public function testItDoesNotMigrateWhenDatabaseIsUpToDate() { diff --git a/tests/integration/Config/RendererTest.php b/tests/integration/Config/RendererTest.php index 20d8975d9c..cca00cf9a1 100644 --- a/tests/integration/Config/RendererTest.php +++ b/tests/integration/Config/RendererTest.php @@ -114,7 +114,7 @@ class RendererTest extends \MailPoetTest { $renderer->render('non-existing-template.html', ['somekey' => 'someval']); self::fail('Twig exception was not rethrown'); } catch (\Exception $e) { - expect($e->getMessage())->contains($exceptionMessage); + expect($e->getMessage())->stringContainsString($exceptionMessage); expect($e->getMessage())->notEquals($exceptionMessage); } } diff --git a/tests/integration/Config/ShortcodesTest.php b/tests/integration/Config/ShortcodesTest.php index 20bcc8a117..e7f298b074 100644 --- a/tests/integration/Config/ShortcodesTest.php +++ b/tests/integration/Config/ShortcodesTest.php @@ -52,7 +52,7 @@ class ShortcodesTest extends \MailPoetTest { $link = $dom->query('a'); /** @var string $link */ $link = $link->attr('href'); - expect($link)->contains('endpoint=view_in_browser'); + expect($link)->stringContainsString('endpoint=view_in_browser'); $parsedLink = parse_url($link, PHP_URL_QUERY); parse_str(html_entity_decode((string)$parsedLink), $data); $requestData = Url::transformUrlDataObject( @@ -73,8 +73,8 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage_subscription]'); - expect($result)->contains('form class="mailpoet-manage-subscription" method="post"'); - expect($result)->contains($subscriber->email); + expect($result)->stringContainsString('form class="mailpoet-manage-subscription" method="post"'); + expect($result)->stringContainsString($subscriber->email); } public function testItAppliesFilterForManageSubscriptionForm() { @@ -94,8 +94,8 @@ class ShortcodesTest extends \MailPoetTest { return $page . ' MY CUSTOM CONTENT'; }); $result = do_shortcode('[mailpoet_manage_subscription]'); - expect($result)->contains('form class="mailpoet-manage-subscription" method="post"'); - expect($result)->contains('MY CUSTOM CONTENT'); + expect($result)->stringContainsString('form class="mailpoet-manage-subscription" method="post"'); + expect($result)->stringContainsString('MY CUSTOM CONTENT'); $wp->removeAllActions('mailpoet_manage_subscription_page'); } @@ -107,7 +107,7 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage_subscription]'); - expect($result)->contains('Subscription management form is only available to mailing lists subscribers.'); + expect($result)->stringContainsString('Subscription management form is only available to mailing lists subscribers.'); } public function testItDoesNotDisplayManageSubscriptionFormForLoggedOutUsers() { @@ -117,7 +117,7 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage_subscription]'); - expect($result)->contains('Subscription management form is only available to mailing lists subscribers.'); + expect($result)->stringContainsString('Subscription management form is only available to mailing lists subscribers.'); } public function testItDisplaysLinkToManageSubscriptionPageForLoggedinExistingUsers() { @@ -132,7 +132,7 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage]'); - expect($result)->contains('Manage your subscription'); + expect($result)->stringContainsString('Manage your subscription'); } public function testItDoesNotDisplayLinkToManageSubscriptionPageForLoggedinNonexistentSubscribers() { @@ -143,7 +143,7 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage]'); - expect($result)->contains('Link to subscription management page is only available to mailing lists subscribers.'); + expect($result)->stringContainsString('Link to subscription management page is only available to mailing lists subscribers.'); } public function testItDoesNotDisplayManageSubscriptionPageForLoggedOutUsers() { @@ -153,7 +153,7 @@ class ShortcodesTest extends \MailPoetTest { $shortcodes = ContainerWrapper::getInstance()->get(Shortcodes::class); $shortcodes->init(); $result = do_shortcode('[mailpoet_manage]'); - expect($result)->contains('Link to subscription management page is only available to mailing lists subscribers.'); + expect($result)->stringContainsString('Link to subscription management page is only available to mailing lists subscribers.'); } public function _after() { diff --git a/tests/integration/Cron/CronHelperTest.php b/tests/integration/Cron/CronHelperTest.php index 73b32a7b54..7cbbfaef6c 100644 --- a/tests/integration/Cron/CronHelperTest.php +++ b/tests/integration/Cron/CronHelperTest.php @@ -271,7 +271,7 @@ class CronHelperTest extends \MailPoetTest { public function testItAllowsSettingCustomCronUrl() { $filter = function($url) { - expect($url)->contains('&endpoint=cron'); + expect($url)->stringContainsString('&endpoint=cron'); return 'http://custom_cron_url'; }; add_filter('mailpoet_cron_request_url', $filter); diff --git a/tests/integration/Cron/Workers/SendingQueue/Tasks/LinksTest.php b/tests/integration/Cron/Workers/SendingQueue/Tasks/LinksTest.php index 64dbb8d674..842678188c 100644 --- a/tests/integration/Cron/Workers/SendingQueue/Tasks/LinksTest.php +++ b/tests/integration/Cron/Workers/SendingQueue/Tasks/LinksTest.php @@ -34,9 +34,9 @@ class LinksTest extends \MailPoetTest { $processedRenderedNewsletterBody = $result[0]; $processedAndHashedLinks = $result[1]; expect($processedRenderedNewsletterBody['html']) - ->contains($processedAndHashedLinks[0]['hash']); + ->stringContainsString($processedAndHashedLinks[0]['hash']); expect($processedRenderedNewsletterBody['text']) - ->contains($processedAndHashedLinks[0]['hash']); + ->stringContainsString($processedAndHashedLinks[0]['hash']); expect($processedAndHashedLinks[0]['link'])->equals('http://example.com'); } @@ -52,7 +52,7 @@ class LinksTest extends \MailPoetTest { $result = Links::process($renderedNewsletter, $newsletter, $queue); $newsletterLink = NewsletterLink::where('newsletter_id', $newsletter->id) ->findOne(); - expect($result['html'])->contains($newsletterLink->hash); + expect($result['html'])->stringContainsString($newsletterLink->hash); } public function testItCanEnsureThatInstantUnsubscribeLinkIsAlwaysPresent() { diff --git a/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php b/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php index 7b642db2e5..d28b46dc41 100644 --- a/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php +++ b/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php @@ -164,13 +164,13 @@ class NewsletterTest extends \MailPoetTest { $updatedQueue = SendingTask::createFromQueue($updatedQueue); $renderedNewsletter = $updatedQueue->getNewsletterRenderedBody(); expect($renderedNewsletter['html']) - ->contains('[mailpoet_click_data]-' . $link->hash); + ->stringContainsString('[mailpoet_click_data]-' . $link->hash); expect($renderedNewsletter['html']) - ->contains('[mailpoet_open_data]'); + ->stringContainsString('[mailpoet_open_data]'); $hookName = 'mailpoet_sending_newsletter_render_after'; expect(WPHooksHelper::isFilterApplied($hookName))->true(); - expect(WPHooksHelper::getFilterApplied($hookName)[0])->internalType('array'); + expect(WPHooksHelper::getFilterApplied($hookName)[0])->array(); expect(WPHooksHelper::getFilterApplied($hookName)[1] instanceof Newsletter)->true(); } @@ -189,13 +189,13 @@ class NewsletterTest extends \MailPoetTest { $updatedQueue = SendingTask::createFromQueue($updatedQueue); $renderedNewsletter = $updatedQueue->getNewsletterRenderedBody(); expect($renderedNewsletter['html']) - ->notContains('[mailpoet_click_data]'); + ->stringNotContainsString('[mailpoet_click_data]'); expect($renderedNewsletter['html']) - ->notContains('[mailpoet_open_data]'); + ->stringNotContainsString('[mailpoet_open_data]'); $hookName = 'mailpoet_sending_newsletter_render_after'; expect(WPHooksHelper::isFilterApplied($hookName))->true(); - expect(WPHooksHelper::getFilterApplied($hookName)[0])->internalType('array'); + expect(WPHooksHelper::getFilterApplied($hookName)[0])->array(); expect(WPHooksHelper::getFilterApplied($hookName)[1] instanceof Newsletter)->true(); } @@ -270,7 +270,7 @@ class NewsletterTest extends \MailPoetTest { $queue = SendingTask::getByNewsletterId($newsletter->id); $wp = new WPFunctions(); expect($queue->newsletterRenderedSubject) - ->contains(date_i18n('jS', $wp->currentTime('timestamp'))); + ->stringContainsString(date_i18n('jS', $wp->currentTime('timestamp'))); } public function testItUsesADefaultSubjectIfRenderedSubjectIsEmptyWhenPreprocessingNewsletter() { @@ -314,11 +314,11 @@ class NewsletterTest extends \MailPoetTest { $this->subscriber, $this->queue ); - expect($result['subject'])->contains($this->subscriber->firstName); + expect($result['subject'])->stringContainsString($this->subscriber->firstName); expect($result['body']['html']) - ->contains(Router::NAME . '&endpoint=track&action=click&data='); + ->stringContainsString(Router::NAME . '&endpoint=track&action=click&data='); expect($result['body']['text']) - ->contains(Router::NAME . '&endpoint=track&action=click&data='); + ->stringContainsString(Router::NAME . '&endpoint=track&action=click&data='); } public function testItDoesNotReplaceSubscriberDataInLinksWhenTrackingIsNotEnabled() { @@ -331,9 +331,9 @@ class NewsletterTest extends \MailPoetTest { $this->queue ); expect($result['body']['html']) - ->notContains(Router::NAME . '&endpoint=track&action=click&data='); + ->stringNotContainsString(Router::NAME . '&endpoint=track&action=click&data='); expect($result['body']['text']) - ->notContains(Router::NAME . '&endpoint=track&action=click&data='); + ->stringNotContainsString(Router::NAME . '&endpoint=track&action=click&data='); } public function testItGetsSegments() { diff --git a/tests/integration/Doctrine/ConnectionFactoryTest.php b/tests/integration/Doctrine/ConnectionFactoryTest.php index 439d059329..5a7530d9ab 100644 --- a/tests/integration/Doctrine/ConnectionFactoryTest.php +++ b/tests/integration/Doctrine/ConnectionFactoryTest.php @@ -48,7 +48,7 @@ class ConnectionFactoryTest extends \MailPoetTest { Env::$dbCharset = ''; $connectionFactory = new ConnectionFactory(); $connection = $connectionFactory->createConnection(); - expect($connection->getParams())->hasntKey('charset'); + expect($connection->getParams())->hasNotKey('charset'); } public function testItSetsUpSocket() { diff --git a/tests/integration/Form/RendererTest.php b/tests/integration/Form/RendererTest.php index 43d8bad127..daecd7f1dd 100755 --- a/tests/integration/Form/RendererTest.php +++ b/tests/integration/Form/RendererTest.php @@ -11,7 +11,7 @@ class RendererTest extends \MailPoetTest { $renderer = ContainerWrapper::getInstance()->get(Renderer::class); assert($renderer instanceof Renderer); $formHtml = $renderer->renderBlocks($formBody); - expect($formHtml)->contains(''); // honey pot - expect($formHtml)->contains('input type="submit" class="mailpoet_submit" value="Subscribe!"'); // Subscribe button + expect($formHtml)->stringContainsString(''); // honey pot + expect($formHtml)->stringContainsString('input type="submit" class="mailpoet_submit" value="Subscribe!"'); // Subscribe button } } diff --git a/tests/integration/Helpscout/BeaconTest.php b/tests/integration/Helpscout/BeaconTest.php index 93e288fa31..377185f1e7 100644 --- a/tests/integration/Helpscout/BeaconTest.php +++ b/tests/integration/Helpscout/BeaconTest.php @@ -92,8 +92,8 @@ class BeaconTest extends \MailPoetTest { public function testItReturnsCurrentThemeNameAndVersion() { $currentTheme = wp_get_theme(); - expect($this->beaconData['Current Theme'])->contains($currentTheme->get('Name')); - expect($this->beaconData['Current Theme'])->contains($currentTheme->get('Version')); + expect($this->beaconData['Current Theme'])->stringContainsString($currentTheme->get('Name')); + expect($this->beaconData['Current Theme'])->stringContainsString($currentTheme->get('Version')); } public function testItReturnsActivePlugins() { @@ -103,8 +103,8 @@ class BeaconTest extends \MailPoetTest { public function testItReturnsSendingMethodDetails() { $mta = $this->settings->get('mta'); expect($this->beaconData['Sending Method'])->equals($mta['method']); - expect($this->beaconData['Sending Frequency'])->contains($mta['frequency']['emails'] . ' emails'); - expect($this->beaconData['Sending Frequency'])->contains($mta['frequency']['interval'] . ' minutes'); + expect($this->beaconData['Sending Frequency'])->stringContainsString($mta['frequency']['emails'] . ' emails'); + expect($this->beaconData['Sending Frequency'])->stringContainsString($mta['frequency']['interval'] . ' minutes'); } public function testItReturnsSomeSettings() { @@ -131,7 +131,7 @@ class BeaconTest extends \MailPoetTest { } public function testItReturnsCronPingUrl() { - expect($this->beaconData['Cron ping URL'])->contains('&action=ping'); + expect($this->beaconData['Cron ping URL'])->stringContainsString('&action=ping'); // cron ping URL should react to custom filters $filter = function($url) { return str_replace(home_url(), 'http://custom_url/', $url); diff --git a/tests/integration/Listing/BulkActionFactoryTest.php b/tests/integration/Listing/BulkActionFactoryTest.php index 70073eb5e1..d838dbe6c2 100644 --- a/tests/integration/Listing/BulkActionFactoryTest.php +++ b/tests/integration/Listing/BulkActionFactoryTest.php @@ -31,7 +31,7 @@ class BulkActionFactoryTest extends \MailPoetTest { $this->bulkActionFactory->registerAction($modelClass, $method, $actionClass); $this->fail('Exception was not thrown'); } catch (\Exception $e) { - expect($e->getMessage())->contains('has no method'); + expect($e->getMessage())->stringContainsString('has no method'); } } @@ -43,7 +43,7 @@ class BulkActionFactoryTest extends \MailPoetTest { $this->bulkActionFactory->registerAction($modelClass, $method, $actionClass); $this->fail('Exception was not thrown'); } catch (\Exception $e) { - expect($e->getMessage())->contains('has no method'); + expect($e->getMessage())->stringContainsString('has no method'); } } @@ -61,7 +61,7 @@ class BulkActionFactoryTest extends \MailPoetTest { $this->bulkActionFactory->getActionClass($modelClass, $method); $this->fail('Exception was not thrown'); } catch (\Exception $e) { - expect($e->getMessage())->contains('has no method'); + expect($e->getMessage())->stringContainsString('has no method'); } } } diff --git a/tests/integration/Mailer/Methods/AmazonSESTest.php b/tests/integration/Mailer/Methods/AmazonSESTest.php index 63487461dd..5307005a66 100644 --- a/tests/integration/Mailer/Methods/AmazonSESTest.php +++ b/tests/integration/Mailer/Methods/AmazonSESTest.php @@ -214,7 +214,7 @@ class AmazonSESTest extends \MailPoetTest { $body = $this->mailer->getBody($this->newsletter, $this->subscriber); $signedRequest = $this->mailer->signRequest($body); expect($signedRequest) - ->contains( + ->stringContainsString( $this->mailer->awsSigningAlgorithm . ' Credential=' . $this->mailer->awsAccessKey . '/' . $this->mailer->getCredentialScope() . ', ' . @@ -242,7 +242,7 @@ class AmazonSESTest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('does not comply with RFC 2822'); + expect($result['error']->getMessage())->stringContainsString('does not comply with RFC 2822'); } public function testItChecksBlacklistBeforeSending() { @@ -259,7 +259,7 @@ class AmazonSESTest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('AmazonSES has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('AmazonSES has returned an unknown error.'); } public function testItCanSend() { diff --git a/tests/integration/Mailer/Methods/MailPoetAPITest.php b/tests/integration/Mailer/Methods/MailPoetAPITest.php index 103bfd2c6c..e62b525e21 100644 --- a/tests/integration/Mailer/Methods/MailPoetAPITest.php +++ b/tests/integration/Mailer/Methods/MailPoetAPITest.php @@ -292,8 +292,8 @@ class MailPoetAPITest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('unknown error'); - expect($result['error']->getMessage())->contains('MailPoet has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('unknown error'); + expect($result['error']->getMessage())->stringContainsString('MailPoet has returned an unknown error.'); } public function testItChecksBlacklistBeforeSendingToMultipleSubscribers() { @@ -318,7 +318,7 @@ class MailPoetAPITest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('unknown error'); - expect($result['error']->getMessage())->contains('MailPoet has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('unknown error'); + expect($result['error']->getMessage())->stringContainsString('MailPoet has returned an unknown error.'); } } diff --git a/tests/integration/Mailer/Methods/PHPMailTest.php b/tests/integration/Mailer/Methods/PHPMailTest.php index 3b62cca1e5..d4018884c2 100644 --- a/tests/integration/Mailer/Methods/PHPMailTest.php +++ b/tests/integration/Mailer/Methods/PHPMailTest.php @@ -152,7 +152,7 @@ class PHPMailTest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('PHPMail has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('PHPMail has returned an unknown error.'); } public function testItCanSend() { diff --git a/tests/integration/Mailer/Methods/SMTPTest.php b/tests/integration/Mailer/Methods/SMTPTest.php index 5eeb017363..2fea2ad5f0 100644 --- a/tests/integration/Mailer/Methods/SMTPTest.php +++ b/tests/integration/Mailer/Methods/SMTPTest.php @@ -198,7 +198,7 @@ class SMTPTest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('SMTP has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('SMTP has returned an unknown error.'); } public function testItCanSend() { diff --git a/tests/integration/Mailer/Methods/SendGridTest.php b/tests/integration/Mailer/Methods/SendGridTest.php index 4a0154966c..0d4b8c6edc 100644 --- a/tests/integration/Mailer/Methods/SendGridTest.php +++ b/tests/integration/Mailer/Methods/SendGridTest.php @@ -56,7 +56,7 @@ class SendGridTest extends \MailPoetTest { public function testItCanGenerateBody() { $body = $this->mailer->getBody($this->newsletter, $this->subscriber, $this->extraParams); - expect($body['to'])->contains($this->subscriber); + expect($body['to'])->stringContainsString($this->subscriber); expect($body['from'])->equals($this->sender['from_email']); expect($body['fromname'])->equals($this->sender['from_name']); expect($body['replyto'])->equals($this->replyTo['reply_to_email']); @@ -108,7 +108,7 @@ class SendGridTest extends \MailPoetTest { ); expect($result['response'])->false(); expect($result['error'])->isInstanceOf(MailerError::class); - expect($result['error']->getMessage())->contains('SendGrid has returned an unknown error.'); + expect($result['error']->getMessage())->stringContainsString('SendGrid has returned an unknown error.'); } public function testItCanSend() { diff --git a/tests/integration/Models/ModelTest.php b/tests/integration/Models/ModelTest.php index 2f2b4f69e8..4f1f938be7 100644 --- a/tests/integration/Models/ModelTest.php +++ b/tests/integration/Models/ModelTest.php @@ -82,7 +82,7 @@ class ModelTest extends \MailPoetTest { $model->save(); $errors = $model->getErrors(); expect($errors)->hasKey(MPModel::DUPLICATE_RECORD); - expect($errors[MPModel::DUPLICATE_RECORD])->contains('Please specify a different "name".'); + expect($errors[MPModel::DUPLICATE_RECORD])->stringContainsString('Please specify a different "name".'); } public function _after() { diff --git a/tests/integration/Models/NewsletterTest.php b/tests/integration/Models/NewsletterTest.php index eeebd2e1f2..b000156212 100644 --- a/tests/integration/Models/NewsletterTest.php +++ b/tests/integration/Models/NewsletterTest.php @@ -145,7 +145,7 @@ class NewsletterTest extends \MailPoetTest { expect($newsletterSegments[0]['id'])->equals($this->segment1->id); expect($newsletterSegments[0]['name'])->equals('Segment 1'); expect($newsletterSegments[1]['id'])->equals($this->segment2->id); - expect($newsletterSegments[1]['name'])->contains('Deleted'); + expect($newsletterSegments[1]['name'])->stringContainsString('Deleted'); } public function testItCanCreateOrUpdate() { diff --git a/tests/integration/Models/SubscriberTest.php b/tests/integration/Models/SubscriberTest.php index 62b7d8ba8b..88500a75c7 100644 --- a/tests/integration/Models/SubscriberTest.php +++ b/tests/integration/Models/SubscriberTest.php @@ -83,7 +83,7 @@ class SubscriberTest extends \MailPoetTest { ]); $subscriber->save(); $errors = $subscriber->getErrors(); - expect($errors[0])->contains("Unknown column 'invalid_column' in 'field list'"); + expect($errors[0])->stringContainsString("Unknown column 'invalid_column' in 'field list'"); } public function testItValidatesEmailAndSetsErrors() { diff --git a/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php b/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php index 38cb936d0c..bb2f33263e 100644 --- a/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php +++ b/tests/integration/Newsletter/Blocks/AbandonedCartContentTest.php @@ -109,10 +109,10 @@ class AbandonedCartContentTest extends \MailPoetTest { $this->accBlock['pricePosition'] = 'hidden'; $result = $this->block->render($newsletter, $this->accBlock, true); $encodedResult = json_encode($result); - expect($encodedResult)->contains('Product 4'); - expect($encodedResult)->contains('Product 3'); - expect($encodedResult)->notContains('Product 2'); - expect($encodedResult)->notContains('Product 1'); + expect($encodedResult)->stringContainsString('Product 4'); + expect($encodedResult)->stringContainsString('Product 3'); + expect($encodedResult)->stringNotContainsString('Product 2'); + expect($encodedResult)->stringNotContainsString('Product 1'); } public function testItDoesNotRenderIfNoSendingTaskIsSupplied() { @@ -144,10 +144,10 @@ class AbandonedCartContentTest extends \MailPoetTest { $sendingTask = $this->createSendingTask($newsletter); $result = $this->block->render($newsletter, $this->accBlock, false, $sendingTask); $encodedResult = json_encode($result); - expect($encodedResult)->notContains('Product 4'); - expect($encodedResult)->contains('Product 3'); - expect($encodedResult)->contains('Product 2'); - expect($encodedResult)->contains('Product 1'); + expect($encodedResult)->stringNotContainsString('Product 4'); + expect($encodedResult)->stringContainsString('Product 3'); + expect($encodedResult)->stringContainsString('Product 2'); + expect($encodedResult)->stringContainsString('Product 1'); } private function createPost(string $title, string $publishDate, string $type = 'post') { diff --git a/tests/integration/Newsletter/Blocks/AutomatedLatestContentBlockTest.php b/tests/integration/Newsletter/Blocks/AutomatedLatestContentBlockTest.php index 248989e9a6..23d0face35 100644 --- a/tests/integration/Newsletter/Blocks/AutomatedLatestContentBlockTest.php +++ b/tests/integration/Newsletter/Blocks/AutomatedLatestContentBlockTest.php @@ -111,10 +111,10 @@ class AutomatedLatestContentBlockTest extends \MailPoetTest { $notificationHistory = $this->createNewsletter('Newsletter', NewsletterEntity::TYPE_NOTIFICATION_HISTORY, $notification); $result = $this->block->render($notificationHistory, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->contains('POST 4'); - expect($encodedResult)->contains('POST 3'); - expect($encodedResult)->notContains('POST 2'); - expect($encodedResult)->notContains('POST 1'); + expect($encodedResult)->stringContainsString('POST 4'); + expect($encodedResult)->stringContainsString('POST 3'); + expect($encodedResult)->stringNotContainsString('POST 2'); + expect($encodedResult)->stringNotContainsString('POST 1'); } public function testItRendersPostOnlyOncePerEmail() { @@ -122,16 +122,16 @@ class AutomatedLatestContentBlockTest extends \MailPoetTest { $notificationHistory = $this->createNewsletter('Newsletter', NewsletterEntity::TYPE_NOTIFICATION_HISTORY, $notification); $result = $this->block->render($notificationHistory, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->contains('POST 4'); - expect($encodedResult)->contains('POST 3'); - expect($encodedResult)->notContains('POST 2'); - expect($encodedResult)->notContains('POST 1'); + expect($encodedResult)->stringContainsString('POST 4'); + expect($encodedResult)->stringContainsString('POST 3'); + expect($encodedResult)->stringNotContainsString('POST 2'); + expect($encodedResult)->stringNotContainsString('POST 1'); $result = $this->block->render($notificationHistory, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->notContains('POST 4'); - expect($encodedResult)->notContains('POST 3'); - expect($encodedResult)->contains('POST 2'); - expect($encodedResult)->contains('POST 1'); + expect($encodedResult)->stringNotContainsString('POST 4'); + expect($encodedResult)->stringNotContainsString('POST 3'); + expect($encodedResult)->stringContainsString('POST 2'); + expect($encodedResult)->stringContainsString('POST 1'); } public function testItCanRenderSamePostsForDifferentPostNotifications() { @@ -139,18 +139,18 @@ class AutomatedLatestContentBlockTest extends \MailPoetTest { $notificationHistory = $this->createNewsletter('Newsletter', NewsletterEntity::TYPE_NOTIFICATION_HISTORY, $notification); $result = $this->block->render($notificationHistory, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->contains('POST 4'); - expect($encodedResult)->contains('POST 3'); - expect($encodedResult)->notContains('POST 2'); - expect($encodedResult)->notContains('POST 1'); + expect($encodedResult)->stringContainsString('POST 4'); + expect($encodedResult)->stringContainsString('POST 3'); + expect($encodedResult)->stringNotContainsString('POST 2'); + expect($encodedResult)->stringNotContainsString('POST 1'); $notification2 = $this->createNewsletter('Newsletter2', NewsletterEntity::TYPE_NOTIFICATION); $notificationHistory2 = $this->createNewsletter('Newsletter2', NewsletterEntity::TYPE_NOTIFICATION_HISTORY, $notification2); $result = $this->block->render($notificationHistory2, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->contains('POST 4'); - expect($encodedResult)->contains('POST 3'); - expect($encodedResult)->notContains('POST 2'); - expect($encodedResult)->notContains('POST 1'); + expect($encodedResult)->stringContainsString('POST 4'); + expect($encodedResult)->stringContainsString('POST 3'); + expect($encodedResult)->stringNotContainsString('POST 2'); + expect($encodedResult)->stringNotContainsString('POST 1'); } public function testItRendersOnlyPostsNewerThanLastSent() { @@ -163,10 +163,10 @@ class AutomatedLatestContentBlockTest extends \MailPoetTest { $this->newsletterPostRepository->flush(); $result = $this->block->render($notificationHistory, $this->alcBlock); $encodedResult = json_encode($result); - expect($encodedResult)->contains('POST 4'); - expect($encodedResult)->notContains('POST 3'); - expect($encodedResult)->notContains('POST 2'); - expect($encodedResult)->notContains('POST 1'); + expect($encodedResult)->stringContainsString('POST 4'); + expect($encodedResult)->stringNotContainsString('POST 3'); + expect($encodedResult)->stringNotContainsString('POST 2'); + expect($encodedResult)->stringNotContainsString('POST 1'); } private function createPost(string $title, string $publishDate, string $type = 'post') { diff --git a/tests/integration/Newsletter/Links/LinksTest.php b/tests/integration/Newsletter/Links/LinksTest.php index c56a547a3b..b3d1ec1af7 100644 --- a/tests/integration/Newsletter/Links/LinksTest.php +++ b/tests/integration/Newsletter/Links/LinksTest.php @@ -74,10 +74,10 @@ class LinksTest extends \MailPoetTest { expect(count($hashedLinks))->equals(2); // links in returned content were replaced with hashes expect($updatedContent) - ->contains(Links::DATA_TAG_CLICK . '-' . $hashedLinks[0]['hash']); + ->stringContainsString(Links::DATA_TAG_CLICK . '-' . $hashedLinks[0]['hash']); expect($updatedContent) - ->contains(Links::DATA_TAG_CLICK . '-' . $hashedLinks[1]['hash']); - expect($updatedContent)->notContains('link'); + ->stringContainsString(Links::DATA_TAG_CLICK . '-' . $hashedLinks[1]['hash']); + expect($updatedContent)->stringNotContainsString('link'); } public function testItHashesAndReplacesLinksWithSpecialCharacters() { @@ -109,10 +109,10 @@ class LinksTest extends \MailPoetTest { expect($replacedLinks)->count(1); // links in returned content were replaced with hashes expect($updatedContent) - ->contains('replace by this'); + ->stringContainsString('replace by this'); expect($updatedContent) - ->contains('[link:some_link_shortcode]'); - expect($updatedContent)->notContains('http://example.com'); + ->stringContainsString('[link:some_link_shortcode]'); + expect($updatedContent)->stringNotContainsString('http://example.com'); } public function testItCreatesAndTransformsUrlDataObject() { @@ -149,8 +149,8 @@ class LinksTest extends \MailPoetTest { $result = Links::replaceSubscriberData($subscriber->id, $queue->id, $template); // there are no click/open data tags - expect($result)->notContains(Links::DATA_TAG_CLICK); - expect($result)->notContains(Links::DATA_TAG_OPEN); + expect($result)->stringNotContainsString(Links::DATA_TAG_CLICK); + expect($result)->stringNotContainsString(Links::DATA_TAG_OPEN); // data tags were converted to URLs expect($result) @@ -233,8 +233,8 @@ class LinksTest extends \MailPoetTest { View in browser Some link'; $result = Links::convertHashedLinksToShortcodesAndUrls($content, $queueId); - expect($result)->contains($newsletterLink->url); - expect($result)->contains('[mailpoet_click_data]-123'); + expect($result)->stringContainsString($newsletterLink->url); + expect($result)->stringContainsString('[mailpoet_click_data]-123'); } public function testItCanEnsureThatUnsubscribeLinkIsAmongProcessedLinks() { @@ -275,8 +275,8 @@ class LinksTest extends \MailPoetTest { View in browser Some link'; $result = Links::convertHashedLinksToShortcodesAndUrls($content, $queueId, $convertAll = true); - expect($result)->contains($newsletterLink1->url); - expect($result)->contains($newsletterLink2->url); + expect($result)->stringContainsString($newsletterLink1->url); + expect($result)->stringContainsString($newsletterLink2->url); } public function _after() { diff --git a/tests/integration/Newsletter/Preview/SendPreviewControllerTest.php b/tests/integration/Newsletter/Preview/SendPreviewControllerTest.php index b5eb217dd9..1750534e66 100644 --- a/tests/integration/Newsletter/Preview/SendPreviewControllerTest.php +++ b/tests/integration/Newsletter/Preview/SendPreviewControllerTest.php @@ -50,15 +50,15 @@ class SendPreviewControllerTest extends \MailPoetTest { $mailerMetaInfo = new MetaInfo; expect(is_array($newsletter))->true(); - expect($newsletter['body']['text'])->contains('Hello test'); + expect($newsletter['body']['text'])->stringContainsString('Hello test'); expect($subscriber)->equals($subscriber); expect($extraParams['unsubscribe_url'])->equals(home_url()); expect($extraParams['meta'])->equals($mailerMetaInfo->getPreviewMetaInfo()); // system links are replaced with hashes - expect($newsletter['body']['html'])->contains('href="' . $viewInBrowserLink . '">View in browser'); - expect($newsletter['body']['html'])->contains('href="' . $unsubscribeLink . '">Unsubscribe'); - expect($newsletter['body']['html'])->contains('href="' . $manageLink . '">Manage subscription'); + expect($newsletter['body']['html'])->stringContainsString('href="' . $viewInBrowserLink . '">View in browser'); + expect($newsletter['body']['html'])->stringContainsString('href="' . $unsubscribeLink . '">Unsubscribe'); + expect($newsletter['body']['html'])->stringContainsString('href="' . $manageLink . '">Manage subscription'); return ['response' => true]; } ), @@ -77,7 +77,7 @@ class SendPreviewControllerTest extends \MailPoetTest { $mailer = $this->makeEmpty(Mailer::class, [ 'send' => function ($newsletter, $subscriber) { expect(is_array($newsletter))->true(); - expect($newsletter['body']['text'])->contains('Hello test'); + expect($newsletter['body']['text'])->stringContainsString('Hello test'); expect($subscriber)->equals($subscriber); return [ 'response' => false, diff --git a/tests/integration/Newsletter/RendererTest.php b/tests/integration/Newsletter/RendererTest.php index 7dc8044d9a..7f05e0074a 100644 --- a/tests/integration/Newsletter/RendererTest.php +++ b/tests/integration/Newsletter/RendererTest.php @@ -103,7 +103,7 @@ class RendererTest extends \MailPoetTest { $renderedColumnContent[] = trim($column->text()); }; expect($renderedColumnContent)->equals($columnContent); - expect((string)$DOM)->contains(' bgcolor="#999999"'); + expect((string)$DOM)->stringContainsString(' bgcolor="#999999"'); } public function testItRendersTwoColumns() { @@ -130,7 +130,7 @@ class RendererTest extends \MailPoetTest { $renderedColumnContent[] = trim($column->text()); }; expect($renderedColumnContent)->equals($columnContent); - expect((string)$DOM)->contains(' bgcolor="#999999"'); + expect((string)$DOM)->stringContainsString(' bgcolor="#999999"'); } public function testItRendersThreeColumns() { @@ -158,7 +158,7 @@ class RendererTest extends \MailPoetTest { $renderedColumnContent[] = trim($column->text()); }; expect($renderedColumnContent)->equals($columnContent); - expect((string)$DOM)->contains(' bgcolor="#999999"'); + expect((string)$DOM)->stringContainsString(' bgcolor="#999999"'); } public function testItRendersScaledColumnBackgroundImage() { @@ -176,12 +176,12 @@ class RendererTest extends \MailPoetTest { ) ); $columnCss = $DOM('td.mailpoet_content')[0]->attr('style'); - expect($columnCss)->contains('background: #999999 url(https://example.com/image.jpg) no-repeat center/cover;'); - expect($columnCss)->contains('background-color: #999999;'); - expect($columnCss)->contains('background-image: url(https://example.com/image.jpg);'); - expect($columnCss)->contains('background-repeat: no-repeat;'); - expect($columnCss)->contains('background-position: center;'); - expect($columnCss)->contains('background-size: cover;'); + expect($columnCss)->stringContainsString('background: #999999 url(https://example.com/image.jpg) no-repeat center/cover;'); + expect($columnCss)->stringContainsString('background-color: #999999;'); + expect($columnCss)->stringContainsString('background-image: url(https://example.com/image.jpg);'); + expect($columnCss)->stringContainsString('background-repeat: no-repeat;'); + expect($columnCss)->stringContainsString('background-position: center;'); + expect($columnCss)->stringContainsString('background-size: cover;'); } public function testItRendersFitColumnBackgroundImage() { @@ -199,12 +199,12 @@ class RendererTest extends \MailPoetTest { ) ); $columnCss = $DOM('td.mailpoet_content')[0]->attr('style'); - expect($columnCss)->contains('background: #999999 url(https://example.com/image.jpg) no-repeat center/contain;'); - expect($columnCss)->contains('background-color: #999999;'); - expect($columnCss)->contains('background-image: url(https://example.com/image.jpg);'); - expect($columnCss)->contains('background-repeat: no-repeat;'); - expect($columnCss)->contains('background-position: center;'); - expect($columnCss)->contains('background-size: contain;'); + expect($columnCss)->stringContainsString('background: #999999 url(https://example.com/image.jpg) no-repeat center/contain;'); + expect($columnCss)->stringContainsString('background-color: #999999;'); + expect($columnCss)->stringContainsString('background-image: url(https://example.com/image.jpg);'); + expect($columnCss)->stringContainsString('background-repeat: no-repeat;'); + expect($columnCss)->stringContainsString('background-position: center;'); + expect($columnCss)->stringContainsString('background-size: contain;'); } public function testItRendersTiledColumnBackgroundImage() { @@ -222,12 +222,12 @@ class RendererTest extends \MailPoetTest { ) ); $columnCss = $DOM('td.mailpoet_content')[0]->attr('style'); - expect($columnCss)->contains('background: #999999 url(https://example.com/image.jpg) repeat center/contain;'); - expect($columnCss)->contains('background-color: #999999;'); - expect($columnCss)->contains('background-image: url(https://example.com/image.jpg);'); - expect($columnCss)->contains('background-repeat: repeat;'); - expect($columnCss)->contains('background-position: center;'); - expect($columnCss)->contains('background-size: contain;'); + expect($columnCss)->stringContainsString('background: #999999 url(https://example.com/image.jpg) repeat center/contain;'); + expect($columnCss)->stringContainsString('background-color: #999999;'); + expect($columnCss)->stringContainsString('background-image: url(https://example.com/image.jpg);'); + expect($columnCss)->stringContainsString('background-repeat: repeat;'); + expect($columnCss)->stringContainsString('background-position: center;'); + expect($columnCss)->stringContainsString('background-size: contain;'); } public function testItRendersFallbackColumnBackgroundColorForBackgroundImage() { @@ -245,8 +245,8 @@ class RendererTest extends \MailPoetTest { ) ); $columnCss = $DOM('td.mailpoet_content')[0]->attr('style'); - expect($columnCss)->contains('background: #ffffff url(https://example.com/image.jpg) repeat center/contain;'); - expect($columnCss)->contains('background-color: #ffffff;'); + expect($columnCss)->stringContainsString('background: #ffffff url(https://example.com/image.jpg) repeat center/contain;'); + expect($columnCss)->stringContainsString('background-color: #ffffff;'); } public function testItRendersHeader() { @@ -314,7 +314,7 @@ class RendererTest extends \MailPoetTest { ]; $renderedImage = (new Image)->render($image, self::COLUMN_BASE_WIDTH); $siteUrl = get_option('siteurl'); - expect($renderedImage)->contains('src="' . $siteUrl . '/relative-path"'); + expect($renderedImage)->stringContainsString('src="' . $siteUrl . '/relative-path"'); $image = [ 'src' => '//path-without-protocol', @@ -325,7 +325,7 @@ class RendererTest extends \MailPoetTest { 'alt' => 'some test alt text', ]; $renderedImage = (new Image)->render($image, self::COLUMN_BASE_WIDTH); - expect($renderedImage)->contains('src="//path-without-protocol"'); + expect($renderedImage)->stringContainsString('src="//path-without-protocol"'); } public function testItRendersImageWithLink() { @@ -334,7 +334,7 @@ class RendererTest extends \MailPoetTest { $template['link'] = 'http://example.com'; $DOM = $this->dOMParser->parseStr((new Image)->render($template, self::COLUMN_BASE_WIDTH)); // element should be wrapped in tag - expect($DOM('tr > td > a', 0)->html())->contains(' td > a', 0)->html())->stringContainsString(' td > a', 0)->attr('href'))->equals($template['link']); } @@ -377,7 +377,7 @@ class RendererTest extends \MailPoetTest { 'alt' => 'some test alt text', ]; $renderedImage = (new Image)->render($image, self::COLUMN_BASE_WIDTH); - expect($renderedImage)->contains('width="auto"'); + expect($renderedImage)->stringContainsString('width="auto"'); } public function testItAdjustImageDimensionsWithPx() { @@ -390,7 +390,7 @@ class RendererTest extends \MailPoetTest { 'alt' => 'some test alt text', ]; $renderedImage = (new Image)->render($image, self::COLUMN_BASE_WIDTH); - expect($renderedImage)->contains('width="620"'); + expect($renderedImage)->stringContainsString('width="620"'); } public function testItAdjustImageDimensionsWithoutPx() { @@ -403,7 +403,7 @@ class RendererTest extends \MailPoetTest { 'alt' => 'some test alt text', ]; $renderedImage = (new Image)->render($image, self::COLUMN_BASE_WIDTH); - expect($renderedImage)->contains('width="620"'); + expect($renderedImage)->stringContainsString('width="620"'); } public function testItRendersText() { @@ -420,10 +420,10 @@ class RendererTest extends \MailPoetTest { // blockquote should contain heading elements but not paragraphs expect( $DOM('tr > td > table > tr > td.mailpoet_blockquote', 0)->html() - )->contains('stringContainsString(' td > table > tr > td.mailpoet_blockquote', 0)->html() - )->notContains('stringNotContainsString(' td > ul.mailpoet_paragraph > li.mailpoet_paragraph', 0)->html() @@ -432,10 +432,10 @@ class RendererTest extends \MailPoetTest { $DOM('tr > td > ol.mailpoet_paragraph > li.mailpoet_paragraph', 0)->html() )->notEmpty(); expect($DOM('tr > td.mailpoet_text > ul.mailpoet_paragraph', 0)->attr('style')) - ->contains('padding-top:0;padding-bottom:0;margin-top:10px;text-align:left;margin-bottom:10px;'); + ->stringContainsString('padding-top:0;padding-bottom:0;margin-top:10px;text-align:left;margin-bottom:10px;'); // headings should be styled expect($DOM('tr > td.mailpoet_text > h1', 0)->attr('style')) - ->contains('padding:0;font-style:normal;font-weight:normal;'); + ->stringContainsString('padding:0;font-style:normal;font-weight:normal;'); // trailing line breaks should be cut off, but not inside an element $template = $newsletter['content']['blocks'][0]['blocks'][0]['blocks'][8]; @@ -443,7 +443,7 @@ class RendererTest extends \MailPoetTest { expect(count($DOM('tr > td > br', 0))) ->equals(0); expect($DOM('tr > td > h3', 0)->html()) - ->contains('stringContainsString(' td', 0)->html())->notEmpty(); expect($DOM('a', 0)->attr('href'))->equals('http://example.com'); - expect($DOM('td > a:nth-of-type(10) > img')->attr('src'))->contains('custom.png'); + expect($DOM('td > a:nth-of-type(10) > img')->attr('src'))->stringContainsString('custom.png'); expect($DOM('td > a:nth-of-type(10) > img')->attr('alt'))->equals('custom'); // there should be 10 icons expect(count($DOM('a > img')))->equals(10); @@ -593,7 +593,7 @@ class RendererTest extends \MailPoetTest { $this->newsletter->setBody(json_decode(Fixtures::get('newsletter_body_template'), true)); $template = $this->renderer->render($this->newsletter); - expect($template['html'])->notContains('mailpoet_logo_newsletter.png'); + expect($template['html'])->stringNotContainsString('mailpoet_logo_newsletter.png'); } public function testItDoesNotAddMailpoetLogoWhenMSSIsActive() { @@ -602,7 +602,7 @@ class RendererTest extends \MailPoetTest { $this->newsletter->setBody(json_decode(Fixtures::get('newsletter_body_template'), true)); $template = $this->renderer->render($this->newsletter); - expect($template['html'])->notContains('mailpoet_logo_newsletter.png'); + expect($template['html'])->stringNotContainsString('mailpoet_logo_newsletter.png'); } public function testItDoesNotAddMailpoetLogoWhenPreviewIsEnabled() { @@ -611,7 +611,7 @@ class RendererTest extends \MailPoetTest { $this->newsletter->setBody(json_decode(Fixtures::get('newsletter_body_template'), true)); $template = $this->renderer->renderAsPreview($this->newsletter); - expect($template['html'])->notContains('mailpoet_logo_newsletter.png'); + expect($template['html'])->stringNotContainsString('mailpoet_logo_newsletter.png'); } public function testItAddsMailpoetLogo() { @@ -620,7 +620,7 @@ class RendererTest extends \MailPoetTest { $this->license->method('hasLicense')->willReturn(false); $template = $this->renderer->render($this->newsletter); - expect($template['html'])->contains('mailpoet_logo_newsletter.png'); + expect($template['html'])->stringContainsString('mailpoet_logo_newsletter.png'); } public function testItPostProcessesTemplate() { diff --git a/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php b/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php index b41ae2c670..d634a45f23 100644 --- a/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php +++ b/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php @@ -172,8 +172,8 @@ class ViewInBrowserRendererTest extends \MailPoetTest { $this->subscriber, $this->sendingTask->queue() ); - expect($renderedBody)->contains('Hello, First'); - expect($renderedBody)->contains(Router::NAME . '&endpoint=view_in_browser'); + expect($renderedBody)->stringContainsString('Hello, First'); + expect($renderedBody)->stringContainsString(Router::NAME . '&endpoint=view_in_browser'); } public function testItRewritesLinksToRouterEndpointWhenTrackingIsEnabled() { @@ -186,7 +186,7 @@ class ViewInBrowserRendererTest extends \MailPoetTest { $this->subscriber, $queue ); - expect($renderedBody)->contains(Router::NAME . '&endpoint=track'); + expect($renderedBody)->stringContainsString(Router::NAME . '&endpoint=track'); } public function testItConvertsHashedLinksToUrlsWhenPreviewIsEnabledAndNewsletterWasSent() { @@ -199,8 +199,8 @@ class ViewInBrowserRendererTest extends \MailPoetTest { $queue ); // hashed link should be replaced with a URL - expect($renderedBody)->notContains('[mailpoet_click_data]'); - expect($renderedBody)->contains(''); + expect($renderedBody)->stringNotContainsString('[mailpoet_click_data]'); + expect($renderedBody)->stringContainsString(''); } public function testRemovesOpenTrackingTagWhenPreviewIsEnabledAndNewsletterWasSent() { @@ -213,8 +213,8 @@ class ViewInBrowserRendererTest extends \MailPoetTest { $queue ); // open tracking data tag should be removed - expect($renderedBody)->notContains('[mailpoet_open_data]'); - expect($renderedBody)->contains(''); + expect($renderedBody)->stringNotContainsString('[mailpoet_open_data]'); + expect($renderedBody)->stringContainsString(''); } public function _after() { diff --git a/tests/integration/Router/RouterTest.php b/tests/integration/Router/RouterTest.php index df492f7691..2ad0e194e2 100644 --- a/tests/integration/Router/RouterTest.php +++ b/tests/integration/Router/RouterTest.php @@ -263,6 +263,6 @@ class RouterTest extends \MailPoetTest { 'test', $data ); - expect($result)->contains(Router::NAME . '&endpoint=router_test_mock_endpoint&action=test&data=' . $encodedData); + expect($result)->stringContainsString(Router::NAME . '&endpoint=router_test_mock_endpoint&action=test&data=' . $encodedData); } } diff --git a/tests/integration/Settings/SettingsControllerTest.php b/tests/integration/Settings/SettingsControllerTest.php index 569f90ee02..162bb4be10 100644 --- a/tests/integration/Settings/SettingsControllerTest.php +++ b/tests/integration/Settings/SettingsControllerTest.php @@ -93,7 +93,7 @@ class SettingsControllerTest extends \MailPoetTest { $this->controller->set('test_key.key1.key2', 1); $this->assertEquals(1, $this->controller->get('test_key.key1.key2')); $this->controller->set('test_key.key1.key2', null); - $this->assertNull(null, $this->controller->get('test_key.key1.key2')); + $this->assertNull($this->controller->get('test_key.key1.key2')); $dbValue = unserialize($this->getSettingValue('test_key')); $this->assertNull($dbValue['key1']['key2']); } diff --git a/tests/integration/Statistics/GATrackingTest.php b/tests/integration/Statistics/GATrackingTest.php index d94435253f..b0be840bdd 100644 --- a/tests/integration/Statistics/GATrackingTest.php +++ b/tests/integration/Statistics/GATrackingTest.php @@ -66,8 +66,8 @@ class GATrackingTest extends \MailPoetTest { 'ga_campaign' => $this->gaCampaign, ]); $result = $tracking->applyGATracking($this->renderedNewsletter, $newsletter, $this->internalHost); - expect($result['text'])->contains('utm_campaign=' . urlencode($this->gaCampaign)); - expect($result['html'])->contains('utm_campaign=' . urlencode($this->gaCampaign)); + expect($result['text'])->stringContainsString('utm_campaign=' . urlencode($this->gaCampaign)); + expect($result['html'])->stringContainsString('utm_campaign=' . urlencode($this->gaCampaign)); } public function testItKeepsShorcodes() { @@ -76,8 +76,8 @@ class GATrackingTest extends \MailPoetTest { 'ga_campaign' => $this->gaCampaign, ]); $result = $tracking->applyGATracking($this->renderedNewsletter, $newsletter, $this->internalHost); - expect($result['text'])->contains('email=[subscriber:email]'); - expect($result['html'])->contains('email=[subscriber:email]'); + expect($result['text'])->stringContainsString('email=[subscriber:email]'); + expect($result['html'])->stringContainsString('email=[subscriber:email]'); } public function _after() { diff --git a/tests/integration/Statistics/Track/ClicksTest.php b/tests/integration/Statistics/Track/ClicksTest.php index 4e9d90e09b..221c9f19b0 100644 --- a/tests/integration/Statistics/Track/ClicksTest.php +++ b/tests/integration/Statistics/Track/ClicksTest.php @@ -133,7 +133,7 @@ class ClicksTest extends \MailPoetTest { $this->queue, $preview = false ); - expect($link)->contains('&endpoint=view_in_browser'); + expect($link)->stringContainsString('&endpoint=view_in_browser'); } public function testItFailsToConvertsInvalidShortcodeToUrl() { diff --git a/tests/integration/Subscribers/ConfirmationEmailMailerTest.php b/tests/integration/Subscribers/ConfirmationEmailMailerTest.php index ba35a51e52..801a4c3ddd 100644 --- a/tests/integration/Subscribers/ConfirmationEmailMailerTest.php +++ b/tests/integration/Subscribers/ConfirmationEmailMailerTest.php @@ -37,8 +37,8 @@ class ConfirmationEmailMailerTest extends \MailPoetTest { $mailer = Stub::makeEmpty(Mailer::class, [ 'send' => Stub\Expected::once(function($email, $subscriber, $extraParams) { - expect($email['body']['html'])->contains('Test segment'); - expect($email['body']['html'])->contains('I confirm my subscription!'); + expect($email['body']['html'])->stringContainsString('Test segment'); + expect($email['body']['html'])->stringContainsString('I confirm my subscription!'); expect($extraParams['meta'])->equals([ 'email_type' => 'confirmation', 'subscriber_status' => 'unconfirmed', diff --git a/tests/integration/Subscribers/ImportExport/Import/MailChimpTest.php b/tests/integration/Subscribers/ImportExport/Import/MailChimpTest.php index 31e2a59ee3..a4fbce64e3 100644 --- a/tests/integration/Subscribers/ImportExport/Import/MailChimpTest.php +++ b/tests/integration/Subscribers/ImportExport/Import/MailChimpTest.php @@ -65,7 +65,7 @@ class MailChimpTest extends \MailPoetTest { $lists = $mailchimp->getLists(); $this->fail('MailChimp getLists() did not throw an exception'); } catch (\Exception $e) { - expect($e->getMessage())->contains('Invalid API Key'); + expect($e->getMessage())->stringContainsString('Invalid API Key'); } } @@ -88,14 +88,14 @@ class MailChimpTest extends \MailPoetTest { $this->mailchimp->getSubscribers(); $this->fail('MailChimp getSubscribers() did not throw an exception'); } catch (\Exception $e) { - expect($e->getMessage())->contains('Did not find any valid lists'); + expect($e->getMessage())->stringContainsString('Did not find any valid lists'); } try { $this->mailchimp->getSubscribers([12]); $this->fail('MailChimp getSubscribers() did not throw an exception'); } catch (\Exception $e) { - expect($e->getMessage())->contains('Did not find any valid lists'); + expect($e->getMessage())->stringContainsString('Did not find any valid lists'); } } @@ -125,7 +125,7 @@ class MailChimpTest extends \MailPoetTest { $this->fail('MailChimp getSubscribers() did not throw an exception'); } catch (\Exception $e) { expect($e->getMessage()) - ->contains('The information received from MailChimp is too large for processing'); + ->stringContainsString('The information received from MailChimp is too large for processing'); } } diff --git a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewsletterClicksExporterTest.php b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewsletterClicksExporterTest.php index 6dabba6ad6..5b7a586898 100644 --- a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewsletterClicksExporterTest.php +++ b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewsletterClicksExporterTest.php @@ -20,7 +20,7 @@ class NewsletterClicksExporterTest extends \MailPoetTest { public function testExportWorksWhenSubscriberNotFound() { $result = $this->exporter->export('email.that@doesnt.exists'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -32,7 +32,7 @@ class NewsletterClicksExporterTest extends \MailPoetTest { 'email' => 'email.that@has.no.newsletters', ]); $result = $this->exporter->export('email.that@has.no.newsletters'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -67,7 +67,7 @@ class NewsletterClicksExporterTest extends \MailPoetTest { 'created_at' => '2018-01-02 15:16:17', ]); $result = $this->exporter->export('email@with.clicks'); - expect($result['data'])->internalType('array'); + expect($result['data'])->array(); expect($result['data'])->count(1); expect($result['done'])->equals(true); expect($result['data'][0])->hasKey('group_id'); diff --git a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewslettersExporterTest.php b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewslettersExporterTest.php index 5f9e761c04..e66bc37396 100644 --- a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewslettersExporterTest.php +++ b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/NewslettersExporterTest.php @@ -20,7 +20,7 @@ class NewslettersExporterTest extends \MailPoetTest { public function testExportWorksWhenSubscriberNotFound() { $result = $this->exporter->export('email.that@doesnt.exists'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -32,7 +32,7 @@ class NewslettersExporterTest extends \MailPoetTest { 'email' => 'email.that@has.no.newsletters', ]); $result = $this->exporter->export('email.that@has.no.newsletters'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -54,7 +54,7 @@ class NewslettersExporterTest extends \MailPoetTest { 'queue_id' => $queue->id(), ]]); $result = $this->exporter->export('user@with.newsletters'); - expect($result['data'])->internalType('array'); + expect($result['data'])->array(); expect($result['data'])->count(1); expect($result['done'])->equals(true); expect($result['data'][0])->hasKey('group_id'); @@ -84,7 +84,7 @@ class NewslettersExporterTest extends \MailPoetTest { ]]); $result = $this->exporter->export('user1@with.newsletters'); expect($result['data'][0]['data'][3]['name'])->equals('Email preview'); - expect($result['data'][0]['data'][3]['value'])->contains('mailpoet_router&endpoint=view_in_browser&action=view&data='); + expect($result['data'][0]['data'][3]['value'])->stringContainsString('mailpoet_router&endpoint=view_in_browser&action=view&data='); } public function testExportOpens() { diff --git a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SegmentsExporterTest.php b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SegmentsExporterTest.php index baee85f8b4..afce7ee44f 100644 --- a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SegmentsExporterTest.php +++ b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SegmentsExporterTest.php @@ -18,7 +18,7 @@ class SegmentsExporterTest extends \MailPoetTest { public function testExportWorksWhenSubscriberNotFound() { $result = $this->exporter->export('email.that@doesnt.exists'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -30,7 +30,7 @@ class SegmentsExporterTest extends \MailPoetTest { 'email' => 'email.that@has.no.segments', ]); $result = $this->exporter->export('email.that@has.no.segments'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -56,7 +56,7 @@ class SegmentsExporterTest extends \MailPoetTest { 'updated_at' => '2018-05-02 15:26:00', ]); $result = $this->exporter->export('email.that@has.some.segments'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result)->hasKey('done'); $expected = [ @@ -81,7 +81,7 @@ class SegmentsExporterTest extends \MailPoetTest { ], ], ]; - expect($result['data'])->internalType('array'); + expect($result['data'])->array(); expect($result['data'])->count(2); expect($result['done'])->equals(true); expect($result['data'][0])->hasKey('group_id'); diff --git a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SubscriberExporterTest.php b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SubscriberExporterTest.php index 0608f69d03..1b590b96b6 100644 --- a/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SubscriberExporterTest.php +++ b/tests/integration/Subscribers/ImportExport/PersonalDataExporters/SubscriberExporterTest.php @@ -17,7 +17,7 @@ class SubscriberExporterTest extends \MailPoetTest { public function testExportWorksWhenSubscriberNotFound() { $result = $this->exporter->export('email.that@doesnt.exists'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result['data'])->equals([]); expect($result)->hasKey('done'); @@ -33,10 +33,10 @@ class SubscriberExporterTest extends \MailPoetTest { 'created_at' => '2018-05-03 10:30:08', ]); $result = $this->exporter->export('email.that@has.no.custom.fields'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('data'); expect($result)->hasKey('done'); - expect($result['data'])->internalType('array'); + expect($result['data'])->array(); expect($result['data'])->count(1); expect($result['done'])->equals(true); expect($result['data'][0])->hasKey('group_id'); diff --git a/tests/integration/Subscribers/NewSubscriberNotificationMailerTest.php b/tests/integration/Subscribers/NewSubscriberNotificationMailerTest.php index 1d9ab6ed88..b8b0412431 100644 --- a/tests/integration/Subscribers/NewSubscriberNotificationMailerTest.php +++ b/tests/integration/Subscribers/NewSubscriberNotificationMailerTest.php @@ -73,8 +73,8 @@ class NewSubscriberNotificationMailerTest extends \MailPoetTest { expect($newsletter['body'])->hasKey('html'); expect($newsletter['body'])->hasKey('text'); expect($newsletter['body'])->count(2); - expect($newsletter['body']['text'])->contains('subscriber@example.com'); - expect($newsletter['body']['html'])->contains('subscriber@example.com'); + expect($newsletter['body']['text'])->stringContainsString('subscriber@example.com'); + expect($newsletter['body']['html'])->stringContainsString('subscriber@example.com'); expect($extraParams['meta'])->equals([ 'email_type' => 'new_subscriber_notification', 'subscriber_status' => 'unknown', diff --git a/tests/integration/Subscribers/SubscriberPersonalDataEraserTest.php b/tests/integration/Subscribers/SubscriberPersonalDataEraserTest.php index 23b18e0f4e..855d9f992c 100644 --- a/tests/integration/Subscribers/SubscriberPersonalDataEraserTest.php +++ b/tests/integration/Subscribers/SubscriberPersonalDataEraserTest.php @@ -22,7 +22,7 @@ class SubscriberPersonalDataEraserTest extends \MailPoetTest { public function testExportWorksWhenSubscriberNotFound() { $result = $this->eraser->erase('email.that@doesnt.exists'); - expect($result)->internalType('array'); + expect($result)->array(); expect($result)->hasKey('items_removed'); expect($result['items_removed'])->equals(0); expect($result)->hasKey('done'); diff --git a/tests/integration/Subscription/ManageSubscriptionFormRendererTest.php b/tests/integration/Subscription/ManageSubscriptionFormRendererTest.php index e26ade9252..19a4a029da 100644 --- a/tests/integration/Subscription/ManageSubscriptionFormRendererTest.php +++ b/tests/integration/Subscription/ManageSubscriptionFormRendererTest.php @@ -22,11 +22,11 @@ class ManageSubscriptionFormRendererTest extends \MailPoetTest { $subscriber = $this->getSubscriber($this->getSegment()); $form = $this->formRenderer->renderForm(Subscriber::findOne($subscriber->getId())); expect($form)->regExp('/
/'); - expect($form)->contains(''); + expect($form)->stringContainsString(''); expect($form)->regExp('//'); expect($form)->regExp('//'); expect($form)->regExp('/ Test segment/'); - expect($form)->contains('Need to change your email address? Unsubscribe here, then simply sign up again.'); + expect($form)->stringContainsString('Need to change your email address? Unsubscribe here, then simply sign up again.'); } public function testItAppliesFieldsFilter() { diff --git a/tests/integration/Subscription/UrlTest.php b/tests/integration/Subscription/UrlTest.php index 20dec88581..926ea85442 100644 --- a/tests/integration/Subscription/UrlTest.php +++ b/tests/integration/Subscription/UrlTest.php @@ -44,43 +44,43 @@ class UrlTest extends \MailPoetTest { $url = $this->url->getCaptchaUrl('abc'); expect($url)->notNull(); - expect($url)->contains('action=captcha'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=captcha'); + expect($url)->stringContainsString('endpoint=subscription'); $url = $this->url->getUnsubscribeUrl(null); expect($url)->notNull(); - expect($url)->contains('action=unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); } public function testItReturnsTheCaptchaUrl() { $url = $this->url->getCaptchaUrl('abc'); expect($url)->notNull(); - expect($url)->contains('action=captcha'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=captcha'); + expect($url)->stringContainsString('endpoint=subscription'); } public function testItReturnsTheCaptchaImageUrl() { $url = $this->url->getCaptchaImageUrl(250, 100, 'abc'); expect($url)->notNull(); - expect($url)->contains('action=captchaImage'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=captchaImage'); + expect($url)->stringContainsString('endpoint=subscription'); } public function testItReturnsTheConfirmationUrl() { // preview $url = $this->url->getConfirmationUrl(null); expect($url)->notNull(); - expect($url)->contains('action=confirm'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm'); + expect($url)->stringContainsString('endpoint=subscription'); // actual subscriber $subscriber = Subscriber::createOrUpdate([ 'email' => 'john@mailpoet.com', ]); $url = $this->url->getConfirmationUrl($subscriber); - expect($url)->contains('action=confirm'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm'); + expect($url)->stringContainsString('endpoint=subscription'); $this->checkSubscriberData($url); } @@ -89,16 +89,16 @@ class UrlTest extends \MailPoetTest { // preview $url = $this->url->getManageUrl(null); expect($url)->notNull(); - expect($url)->contains('action=manage'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=manage'); + expect($url)->stringContainsString('endpoint=subscription'); // actual subscriber $subscriber = Subscriber::createOrUpdate([ 'email' => 'john@mailpoet.com', ]); $url = $this->url->getManageUrl($subscriber); - expect($url)->contains('action=manage'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=manage'); + expect($url)->stringContainsString('endpoint=subscription'); $this->checkSubscriberData($url); } @@ -107,8 +107,8 @@ class UrlTest extends \MailPoetTest { // preview $url = $this->url->getUnsubscribeUrl(null); expect($url)->notNull(); - expect($url)->contains('action=unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->getUrlData($url); expect($data['preview'])->equals(1); @@ -117,23 +117,23 @@ class UrlTest extends \MailPoetTest { 'email' => 'john@mailpoet.com', ]); $url = $this->url->getUnsubscribeUrl($subscriber); - expect($url)->contains('action=unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $this->checkSubscriberData($url); // subscriber and query id $url = $this->url->getUnsubscribeUrl($subscriber, 10); - expect($url)->contains('action=unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->checkSubscriberData($url); expect($data['queueId'])->equals(10); // no subscriber but query id $url = $this->url->getUnsubscribeUrl(null, 10); - expect($url)->contains('action=unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->getUrlData($url); expect(isset($data['data']['queueId']))->false(); @@ -144,8 +144,8 @@ class UrlTest extends \MailPoetTest { // preview $url = $this->url->getConfirmUnsubscribeUrl(null); expect($url)->notNull(); - expect($url)->contains('action=confirm_unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm_unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->getUrlData($url); expect($data['preview'])->equals(1); @@ -154,23 +154,23 @@ class UrlTest extends \MailPoetTest { 'email' => 'john@mailpoet.com', ]); $url = $this->url->getConfirmUnsubscribeUrl($subscriber); - expect($url)->contains('action=confirm_unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm_unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $this->checkSubscriberData($url); // subscriber and query id $url = $this->url->getConfirmUnsubscribeUrl($subscriber, 10); - expect($url)->contains('action=confirm_unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm_unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->checkSubscriberData($url); expect($data['queueId'])->equals(10); // no subscriber but query id $url = $this->url->getConfirmUnsubscribeUrl(null, 10); - expect($url)->contains('action=confirm_unsubscribe'); - expect($url)->contains('endpoint=subscription'); + expect($url)->stringContainsString('action=confirm_unsubscribe'); + expect($url)->stringContainsString('endpoint=subscription'); $data = $this->getUrlData($url); expect(isset($data['data']['queueId']))->false(); @@ -179,7 +179,7 @@ class UrlTest extends \MailPoetTest { private function checkSubscriberData(string $url) { $data = $this->getUrlData($url); - expect($data['email'])->contains('john@mailpoet.com'); + expect($data['email'])->stringContainsString('john@mailpoet.com'); expect($data['token'])->notEmpty(); return $data; } diff --git a/tests/integration/Util/Notices/HeadersAlreadySentNoticeTest.php b/tests/integration/Util/Notices/HeadersAlreadySentNoticeTest.php index ac4ffb7e85..9594b90c4b 100644 --- a/tests/integration/Util/Notices/HeadersAlreadySentNoticeTest.php +++ b/tests/integration/Util/Notices/HeadersAlreadySentNoticeTest.php @@ -31,8 +31,8 @@ class HeadersAlreadySentNoticeTest extends \MailPoetTest { ['headersSent' => true] ); $notice = $headersAlreadySentNotice->init(true); - expect($notice->getMessage())->contains('It looks like there\'s an issue with some of the PHP files on your website'); - expect($notice->getMessage())->contains('https://kb.mailpoet.com/article/325-the-captcha-image-doesnt-show-up'); + expect($notice->getMessage())->stringContainsString('It looks like there\'s an issue with some of the PHP files on your website'); + expect($notice->getMessage())->stringContainsString('https://kb.mailpoet.com/article/325-the-captcha-image-doesnt-show-up'); } public function testItPrintsNoWarningWhenHeadersAreNotSent() { @@ -54,7 +54,7 @@ class HeadersAlreadySentNoticeTest extends \MailPoetTest { ['headersSent' => false] ); $notice = $headersAlreadySentNotice->init(true); - expect($notice->getMessage())->contains('It looks like there\'s an issue with some of the PHP files on your website'); + expect($notice->getMessage())->stringContainsString('It looks like there\'s an issue with some of the PHP files on your website'); ob_end_clean(); } @@ -82,22 +82,22 @@ class HeadersAlreadySentNoticeTest extends \MailPoetTest { public function testItPrintsCaptchaAndTrackingMessagesIfEnabled() { $headersAlreadySentNotice = Stub::make(HeadersAlreadySentNotice::class); $notice = $headersAlreadySentNotice->display(true, true); - expect($notice->getMessage())->contains('Inaccurate tracking'); - expect($notice->getMessage())->contains('CAPTCHA not rendering'); + expect($notice->getMessage())->stringContainsString('Inaccurate tracking'); + expect($notice->getMessage())->stringContainsString('CAPTCHA not rendering'); } public function testItPrintsNoCaptchaMessageIfCaptchaDisabled() { $headersAlreadySentNotice = Stub::make(HeadersAlreadySentNotice::class); $notice = $headersAlreadySentNotice->display(false, true); - expect($notice->getMessage())->contains('Inaccurate tracking'); - expect($notice->getMessage())->notContains('CAPTCHA not rendering'); + expect($notice->getMessage())->stringContainsString('Inaccurate tracking'); + expect($notice->getMessage())->stringNotContainsString('CAPTCHA not rendering'); } public function testItPrintsNoTrackingMessageIftrackingDisabled() { $headersAlreadySentNotice = Stub::make(HeadersAlreadySentNotice::class); $notice = $headersAlreadySentNotice->display(true, false); - expect($notice->getMessage())->notContains('Inaccurate tracking'); - expect($notice->getMessage())->contains('CAPTCHA not rendering'); + expect($notice->getMessage())->stringNotContainsString('Inaccurate tracking'); + expect($notice->getMessage())->stringContainsString('CAPTCHA not rendering'); } public function testItPrintsNoMessagesWhenCaptchaAndTrackingDisabled() { diff --git a/tests/integration/Util/Notices/InactiveSubscribersNoticeTest.php b/tests/integration/Util/Notices/InactiveSubscribersNoticeTest.php index 7edbd855a1..9b62fd6210 100644 --- a/tests/integration/Util/Notices/InactiveSubscribersNoticeTest.php +++ b/tests/integration/Util/Notices/InactiveSubscribersNoticeTest.php @@ -16,9 +16,9 @@ class InactiveSubscribersNoticeTest extends \MailPoetTest { $notice = new InactiveSubscribersNotice(SettingsController::getInstance(), new WPFunctions()); $result = $notice->init(true); - expect($result)->contains('Good news! MailPoet won’t send emails to your 50 inactive subscribers.'); - expect($result)->contains('https://kb.mailpoet.com/article/264-inactive-subscribers'); - expect($result)->contains('Go to the Advanced Settings'); + expect($result)->stringContainsString('Good news! MailPoet won’t send emails to your 50 inactive subscribers.'); + expect($result)->stringContainsString('https://kb.mailpoet.com/article/264-inactive-subscribers'); + expect($result)->stringContainsString('Go to the Advanced Settings'); } public function testItDoesntDisplayWhenDisabled() { diff --git a/tests/integration/Util/Notices/PHPVersionWarningsTest.php b/tests/integration/Util/Notices/PHPVersionWarningsTest.php index 82447dfbf4..38b96addf0 100644 --- a/tests/integration/Util/Notices/PHPVersionWarningsTest.php +++ b/tests/integration/Util/Notices/PHPVersionWarningsTest.php @@ -35,14 +35,14 @@ class PHPVersionWarningsTest extends \MailPoetTest { public function testItPrintsWarningFor70() { $warning = $this->phpVersionWarning->init('7.0.0', true); - expect($warning->getMessage())->contains('Your website is running on PHP 7.0.0'); - expect($warning->getMessage())->contains('https://www.mailpoet.com/let-us-handle-your-php-upgrade/'); + expect($warning->getMessage())->stringContainsString('Your website is running on PHP 7.0.0'); + expect($warning->getMessage())->stringContainsString('https://www.mailpoet.com/let-us-handle-your-php-upgrade/'); } public function testItPrintsWarningFor71() { $warning = $this->phpVersionWarning->init('7.1.0', true); - expect($warning->getMessage())->contains('Your website is running on PHP 7.1.0'); - expect($warning->getMessage())->contains('https://www.mailpoet.com/let-us-handle-your-php-upgrade/'); + expect($warning->getMessage())->stringContainsString('Your website is running on PHP 7.1.0'); + expect($warning->getMessage())->stringContainsString('https://www.mailpoet.com/let-us-handle-your-php-upgrade/'); } public function testItPrintsNoWarningFor72() { diff --git a/tests/integration/WooCommerce/SubscriptionTest.php b/tests/integration/WooCommerce/SubscriptionTest.php index 5119b754a4..5f74b5f2f5 100644 --- a/tests/integration/WooCommerce/SubscriptionTest.php +++ b/tests/integration/WooCommerce/SubscriptionTest.php @@ -61,7 +61,7 @@ class SubscriptionTest extends \MailPoetTest { $subscriber, [$this->wcSegment->id] ); - expect($this->getRenderedOptinField())->contains('checked'); + expect($this->getRenderedOptinField())->stringContainsString('checked'); } public function testItDisplaysAnUncheckedCheckboxIfCurrentUserIsNotSubscribed() { @@ -73,18 +73,18 @@ class SubscriptionTest extends \MailPoetTest { $subscriber, [$this->wcSegment->id] ); - expect($this->getRenderedOptinField())->notContains('checked'); + expect($this->getRenderedOptinField())->stringNotContainsString('checked'); } public function testItDisplaysAnUncheckedCheckboxIfCurrentUserIsNotLoggedIn() { wp_set_current_user(0); - expect($this->getRenderedOptinField())->notContains('checked'); + expect($this->getRenderedOptinField())->stringNotContainsString('checked'); } public function testItDisplaysCheckboxOptinMessageFromSettings() { $newMessage = 'This is a test message.'; $this->settings->set(Subscription::OPTIN_MESSAGE_SETTING_NAME, $newMessage); - expect($this->getRenderedOptinField())->contains($newMessage); + expect($this->getRenderedOptinField())->stringContainsString($newMessage); } public function testItsTemplateCanBeOverriddenByAHook() { @@ -98,8 +98,8 @@ class SubscriptionTest extends \MailPoetTest { 4 ); $result = $this->getRenderedOptinField(); - expect($result)->contains($newTemplate); - expect($result)->contains(Subscription::CHECKOUT_OPTIN_INPUT_NAME); + expect($result)->stringContainsString($newTemplate); + expect($result)->stringContainsString(Subscription::CHECKOUT_OPTIN_INPUT_NAME); } public function testItDoesNotTryToSubscribeIfThereIsNoEmailInOrderData() { diff --git a/tests/integration/WooCommerce/TransactionalEmails/RendererTest.php b/tests/integration/WooCommerce/TransactionalEmails/RendererTest.php index 7ada379ca0..26812159d1 100644 --- a/tests/integration/WooCommerce/TransactionalEmails/RendererTest.php +++ b/tests/integration/WooCommerce/TransactionalEmails/RendererTest.php @@ -60,10 +60,10 @@ class RendererTest extends \MailPoetTest { $renderer = new Renderer(new csstidy, $newsletterRenderer); $renderer->render($this->newsletter); $html = $renderer->getHTMLBeforeContent('Heading Text'); - expect($html)->contains('Some text before heading'); - expect($html)->contains('Heading Text'); - expect($html)->contains('Some text between heading and content'); - expect($html)->notContains('Some text after content'); + expect($html)->stringContainsString('Some text before heading'); + expect($html)->stringContainsString('Heading Text'); + expect($html)->stringContainsString('Some text between heading and content'); + expect($html)->stringNotContainsString('Some text after content'); } public function testGetHTMLAfterContent() { @@ -91,10 +91,10 @@ class RendererTest extends \MailPoetTest { $renderer = new Renderer(new csstidy, $newsletterRenderer); $renderer->render($this->newsletter); $html = $renderer->getHTMLAfterContent(); - expect($html)->notContains('Some text before heading'); - expect($html)->notContains('Heading Text'); - expect($html)->notContains('Some text between heading and content'); - expect($html)->contains('Some text after content'); + expect($html)->stringNotContainsString('Some text before heading'); + expect($html)->stringNotContainsString('Heading Text'); + expect($html)->stringNotContainsString('Some text between heading and content'); + expect($html)->stringContainsString('Some text after content'); } public function testPrefixCss() { @@ -106,8 +106,8 @@ class RendererTest extends \MailPoetTest { font-weight:bold; } '); - expect($css)->contains("#mailpoet_woocommerce_container #some_id {\ncolor:black\n}"); - expect($css)->contains("#mailpoet_woocommerce_container .some-class {\nheight:50px;\nwidth:30px\n}"); - expect($css)->contains("#mailpoet_woocommerce_container h1 {\nfont-weight:700\n}"); + expect($css)->stringContainsString("#mailpoet_woocommerce_container #some_id {\ncolor:black\n}"); + expect($css)->stringContainsString("#mailpoet_woocommerce_container .some-class {\nheight:50px;\nwidth:30px\n}"); + expect($css)->stringContainsString("#mailpoet_woocommerce_container h1 {\nfont-weight:700\n}"); } } diff --git a/tests/integration/WooCommerce/TransactionalEmailsTest.php b/tests/integration/WooCommerce/TransactionalEmailsTest.php index a1c7fbf2b6..6408d2b3ae 100644 --- a/tests/integration/WooCommerce/TransactionalEmailsTest.php +++ b/tests/integration/WooCommerce/TransactionalEmailsTest.php @@ -90,7 +90,7 @@ class TransactionalEmailsTest extends \MailPoetTest { 'type' => NewsletterEntity::TYPE_WC_TRANSACTIONAL_EMAIL, ]); expect($email)->notEmpty(); - expect(json_encode($email->getBody()))->contains('my-awesome-image-url'); + expect(json_encode($email->getBody()))->stringContainsString('my-awesome-image-url'); } public function testInitStripsUnwantedTagsFromWCFooterText() { diff --git a/tests/integration/_bootstrap.php b/tests/integration/_bootstrap.php index 18f20cf01d..f550efb923 100644 --- a/tests/integration/_bootstrap.php +++ b/tests/integration/_bootstrap.php @@ -23,6 +23,7 @@ $models = [ 'Form', 'Newsletter', 'NewsletterLink', + 'NewsletterLink', 'NewsletterPost', 'NewsletterSegment', 'NewsletterOption', @@ -204,7 +205,7 @@ abstract class MailPoetTest extends \Codeception\TestCase\Test { // phpcs:ignore return $method->invokeArgs($object, $parameters); } - public static function markTestSkipped($message = '') { + public static function markTestSkipped(string $message = ''): void { $branchName = getenv('CIRCLE_BRANCH'); if ($branchName === 'master' || $branchName === 'release') { self::fail('Cannot skip tests on this branch.');