Fix integration tests to work with updated codeception/verify
[MAILPOET-3203]
This commit is contained in:
committed by
Veljko V
parent
e85b4c6fec
commit
54727ad9a2
@ -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('!^\/\/!');
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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!');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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);
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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('<input type="email" name="data[email]"/>'); // honey pot
|
||||
expect($formHtml)->contains('input type="submit" class="mailpoet_submit" value="Subscribe!"'); // Subscribe button
|
||||
expect($formHtml)->stringContainsString('<input type="email" name="data[email]"/>'); // honey pot
|
||||
expect($formHtml)->stringContainsString('input type="submit" class="mailpoet_submit" value="Subscribe!"'); // Subscribe button
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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.');
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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') {
|
||||
|
@ -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') {
|
||||
|
@ -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 {
|
||||
<a href="[mailpoet_click_data]-90e56">View in browser</a>
|
||||
<a href="[mailpoet_click_data]-123">Some link</a>';
|
||||
$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 {
|
||||
<a href="[mailpoet_click_data]-90e56">View in browser</a>
|
||||
<a href="[mailpoet_click_data]-123">Some link</a>';
|
||||
$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() {
|
||||
|
@ -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,
|
||||
|
@ -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 <a> tag
|
||||
expect($DOM('tr > td > a', 0)->html())->contains('<img');
|
||||
expect($DOM('tr > td > a', 0)->html())->stringContainsString('<img');
|
||||
expect($DOM('tr > 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('<h2');
|
||||
)->stringContainsString('<h2');
|
||||
expect(
|
||||
$DOM('tr > td > table > tr > td.mailpoet_blockquote', 0)->html()
|
||||
)->notContains('<p');
|
||||
)->stringNotContainsString('<p');
|
||||
// ul/ol/li should have mailpoet_paragraph class added & styles applied
|
||||
expect(
|
||||
$DOM('tr > 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('<a');
|
||||
->stringContainsString('<a');
|
||||
}
|
||||
|
||||
public function testItRendersDivider() {
|
||||
@ -540,7 +540,7 @@ class RendererTest extends \MailPoetTest {
|
||||
// image source/link href/alt should be properly set
|
||||
expect($DOM('tr > 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() {
|
||||
|
@ -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('<a href="http://google.com">');
|
||||
expect($renderedBody)->stringNotContainsString('[mailpoet_click_data]');
|
||||
expect($renderedBody)->stringContainsString('<a href="http://google.com">');
|
||||
}
|
||||
|
||||
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('<img alt="" class="" src="">');
|
||||
expect($renderedBody)->stringNotContainsString('[mailpoet_open_data]');
|
||||
expect($renderedBody)->stringContainsString('<img alt="" class="" src="">');
|
||||
}
|
||||
|
||||
public function _after() {
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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']);
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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('<strong>Test segment</strong>');
|
||||
expect($email['body']['html'])->contains('<a target="_blank" href="http://example.com">I confirm my subscription!</a>');
|
||||
expect($email['body']['html'])->stringContainsString('<strong>Test segment</strong>');
|
||||
expect($email['body']['html'])->stringContainsString('<a target="_blank" href="http://example.com">I confirm my subscription!</a>');
|
||||
expect($extraParams['meta'])->equals([
|
||||
'email_type' => 'confirmation',
|
||||
'subscriber_status' => 'unconfirmed',
|
||||
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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() {
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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',
|
||||
|
@ -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');
|
||||
|
@ -22,11 +22,11 @@ class ManageSubscriptionFormRendererTest extends \MailPoetTest {
|
||||
$subscriber = $this->getSubscriber($this->getSegment());
|
||||
$form = $this->formRenderer->renderForm(Subscriber::findOne($subscriber->getId()));
|
||||
expect($form)->regExp('/<form class="mailpoet-manage-subscription" method="post" action="[a-z0-9:\/\._]+wp-admin\/admin-post.php" novalidate>/');
|
||||
expect($form)->contains('<input type="hidden" name="data[email]" value="subscriber@test.com" />');
|
||||
expect($form)->stringContainsString('<input type="hidden" name="data[email]" value="subscriber@test.com" />');
|
||||
expect($form)->regExp('/<input type="text" class="mailpoet_text" name="data\[[a-zA-Z0-9=_]+\]" title="First name" value="Fname" data-automation-id="form_first_name" \/>/');
|
||||
expect($form)->regExp('/<input type="text" class="mailpoet_text" name="data\[[a-zA-Z0-9=_]+\]" title="Last name" value="Lname" data-automation-id="form_last_name" \/>/');
|
||||
expect($form)->regExp('/<input type="checkbox" class="mailpoet_checkbox" name="data\[[a-zA-Z0-9=_]+\]\[\]" value="1" data-parsley-required="true" data-parsley-group="segments" data-parsley-errors-container="\.mailpoet_error_segments" data-parsley-required-message="Please select a list" \/> 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() {
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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('<a href="admin.php?page=mailpoet-settings#advanced" class="button button-primary">Go to the Advanced Settings</a>');
|
||||
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('<a href="admin.php?page=mailpoet-settings#advanced" class="button button-primary">Go to the Advanced Settings</a>');
|
||||
}
|
||||
|
||||
public function testItDoesntDisplayWhenDisabled() {
|
||||
|
@ -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() {
|
||||
|
@ -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() {
|
||||
|
@ -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}");
|
||||
}
|
||||
}
|
||||
|
@ -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() {
|
||||
|
@ -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.');
|
||||
|
Reference in New Issue
Block a user