diff --git a/mailpoet/RoboFile.php b/mailpoet/RoboFile.php index 401758e220..9da9ffcdce 100644 --- a/mailpoet/RoboFile.php +++ b/mailpoet/RoboFile.php @@ -507,7 +507,7 @@ class RoboFile extends \Robo\Tasks { public function resetTestDocker() { return $this ->taskExec( - 'docker-compose down -v --remove-orphans' + 'docker-compose down -v --remove-orphans' )->dir(__DIR__ . '/tests/docker') ->addCode([$this, 'cleanupCachedFiles']) ->run(); @@ -1488,7 +1488,7 @@ class RoboFile extends \Robo\Tasks { new TwigFileSystem($templatePath) ); $twig = $renderer->getTwig(); - foreach ($this->rsearch($templatePath, ['html','hbs','txt']) as $template) { + foreach ($this->rsearch($templatePath, ['html', 'hbs', 'txt']) as $template) { $path = substr($template, strlen($templatePath)); $twig->load($path); } diff --git a/mailpoet/tasks/form-export/form-export.php b/mailpoet/tasks/form-export/form-export.php index 22f1491d1b..f546981720 100644 --- a/mailpoet/tasks/form-export/form-export.php +++ b/mailpoet/tasks/form-export/form-export.php @@ -43,7 +43,7 @@ function mailpoetRenderFormList() { '%s (ID: %d)', esc_html($name), (int)$form->getId() - ) . + ) . ''; } echo ""; diff --git a/mailpoet/tasks/release/ChangelogController.php b/mailpoet/tasks/release/ChangelogController.php index a4e4b318ea..13ba153249 100644 --- a/mailpoet/tasks/release/ChangelogController.php +++ b/mailpoet/tasks/release/ChangelogController.php @@ -63,7 +63,7 @@ class ChangelogController { } private function sanitizePunctuation($message, $fallback) { - $validPunctuation = ['?','.','!']; + $validPunctuation = ['?', '.', '!']; $message = rtrim($message, ';, '); if (!in_array(substr($message, -1), $validPunctuation)) { $message .= $fallback; diff --git a/mailpoet/tests/DataFactories/User.php b/mailpoet/tests/DataFactories/User.php index bd6ff1241e..211e67d12e 100644 --- a/mailpoet/tests/DataFactories/User.php +++ b/mailpoet/tests/DataFactories/User.php @@ -8,7 +8,7 @@ use WP_User; class User { public function createUser($name, $role, $email): WP_User { if (is_multisite()) { - $userId = wpmu_create_user($name, "$name-password", $email) ; + $userId = wpmu_create_user($name, "$name-password", $email); } else { $userId = wp_create_user($name, "$name-password", $email); } diff --git a/mailpoet/tests/DataGenerator/Generators/WooCommercePastRevenues.php b/mailpoet/tests/DataGenerator/Generators/WooCommercePastRevenues.php index 7d8e5e79fb..6eac55102f 100644 --- a/mailpoet/tests/DataGenerator/Generators/WooCommercePastRevenues.php +++ b/mailpoet/tests/DataGenerator/Generators/WooCommercePastRevenues.php @@ -542,7 +542,7 @@ class WooCommercePastRevenues implements Generator { $order->set_date_completed($completedAt->toDateTimeString()); $order->set_date_paid($completedAt->toDateTimeString()); $orderCreatedTime = $completedAt->subMinute()->toDateTimeString(); - $order->set_date_created(get_gmt_from_date( $orderCreatedTime )); + $order->set_date_created(get_gmt_from_date($orderCreatedTime)); $order->save(); } return $order; diff --git a/mailpoet/tests/_support/IntegrationTester.php b/mailpoet/tests/_support/IntegrationTester.php index 1b8023aeb1..239ba612c6 100644 --- a/mailpoet/tests/_support/IntegrationTester.php +++ b/mailpoet/tests/_support/IntegrationTester.php @@ -92,7 +92,8 @@ class IntegrationTester extends \Codeception\Actor { $this->entityManager->getConnection()->executeStatement( "DELETE FROM {$wpdb->users} WHERE id = :id", - ['id' => $id], ['id' => \PDO::PARAM_INT] + ['id' => $id], + ['id' => \PDO::PARAM_INT] ); } diff --git a/mailpoet/tests/_support/woo_cot_helper_plugin.php b/mailpoet/tests/_support/woo_cot_helper_plugin.php index 178d2a7125..d473ab4a4f 100644 --- a/mailpoet/tests/_support/woo_cot_helper_plugin.php +++ b/mailpoet/tests/_support/woo_cot_helper_plugin.php @@ -26,7 +26,7 @@ function mailpoet_enable_cot(): void { } } -add_action( 'init', 'mailpoet_enable_cot', 99 ); +add_action('init', 'mailpoet_enable_cot', 99); /** * Add wp create_cot WP CLI command for creating Custom Order Tables from command line diff --git a/mailpoet/tests/acceptance/Automation/SomeoneSubscribesAutomationTriggeredBySubscriberEditCest.php b/mailpoet/tests/acceptance/Automation/SomeoneSubscribesAutomationTriggeredBySubscriberEditCest.php index 2eb265ff9b..ab510cb1d9 100644 --- a/mailpoet/tests/acceptance/Automation/SomeoneSubscribesAutomationTriggeredBySubscriberEditCest.php +++ b/mailpoet/tests/acceptance/Automation/SomeoneSubscribesAutomationTriggeredBySubscriberEditCest.php @@ -85,7 +85,7 @@ class SomeoneSubscribesAutomationTriggeredBySubscriberEditCest { } private function amOnTheSubscriberEditPageFor(\AcceptanceTester $i, string $email) { - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->waitForText($email); $i->click($email); $i->waitForElement('input[value="' . $email . '"]'); diff --git a/mailpoet/tests/acceptance/Forms/EditorAddListSelectionCest.php b/mailpoet/tests/acceptance/Forms/EditorAddListSelectionCest.php index 0127bb8733..ba4d81da8d 100644 --- a/mailpoet/tests/acceptance/Forms/EditorAddListSelectionCest.php +++ b/mailpoet/tests/acceptance/Forms/EditorAddListSelectionCest.php @@ -101,7 +101,7 @@ class EditorAddListSelectionCest { $i->seeNoJSErrors(); $i->wantTo('Make sure the subscriber is subscribed to those lists'); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->waitForListingItemsToLoad(); $i->see($firstSegmentName); $i->see($secondSegmentName); diff --git a/mailpoet/tests/acceptance/Settings/CustomUnsubscribePageCest.php b/mailpoet/tests/acceptance/Settings/CustomUnsubscribePageCest.php index 8262cd602e..b65e1be9ed 100644 --- a/mailpoet/tests/acceptance/Settings/CustomUnsubscribePageCest.php +++ b/mailpoet/tests/acceptance/Settings/CustomUnsubscribePageCest.php @@ -8,7 +8,7 @@ class CustomUnsubscribePageCest { $pageTitle = 'SorryToSeeYouGo'; $pageText = 'Manage your subscription'; $pageContent = "[mailpoet_manage text=\"$pageText\"]"; - $i->cli(['post', 'create', '--post_type=page', '--post_status=publish', "--post_title='$pageTitle'" , "--post_content='$pageContent'" ]); + $i->cli(['post', 'create', '--post_type=page', '--post_status=publish', "--post_title='$pageTitle'", "--post_content='$pageContent'"]); $i->login(); $i->amOnPage('/wp-admin/edit.php?post_type=page'); $i->waitForText($pageTitle); diff --git a/mailpoet/tests/acceptance/Subscribers/ManageImportExportCest.php b/mailpoet/tests/acceptance/Subscribers/ManageImportExportCest.php index 92ea22aab3..e1f25a52e9 100644 --- a/mailpoet/tests/acceptance/Subscribers/ManageImportExportCest.php +++ b/mailpoet/tests/acceptance/Subscribers/ManageImportExportCest.php @@ -45,7 +45,7 @@ class ManageImportExportCest { public function importUsersToSubscribersViaCSV(\AcceptanceTester $i) { $i->wantTo('Import a subscriber list from CSV'); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->click('[data-automation-id="import-subscribers-button"]'); $this->proceedThroughListCleaning($i); $this->uploadCsvFile($i); @@ -64,7 +64,7 @@ class ManageImportExportCest { $i->see('9 existing subscribers were updated and added to'); //confirm subscribers from import list were added - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->searchFor('aaa@example.com'); $i->waitForText('aaa@example.com'); $i->waitForText('My tag'); @@ -98,7 +98,7 @@ class ManageImportExportCest { public function importListViaPasteBox(\AcceptanceTester $i) { $i->wantTo('Import a subscriber list via paste box'); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->click('[data-automation-id="import-subscribers-button"]'); $this->proceedThroughListCleaning($i); $this->pasteSimpleList($i); @@ -114,7 +114,7 @@ class ManageImportExportCest { $i->cli(['user', 'create', 'janedoe', 'janedoe@example.com', '--role=subscriber', '--first_name=John', '--last_name=Doe']); $i->cli(['user', 'create', 'jamesdoe', 'jamesdoe@example.com', '--role=subscriber', '--first_name=John', '--last_name=Doe']); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->click('[data-automation-id="import-subscribers-button"]'); $this->proceedThroughListCleaning($i); $this->pasteSimpleList($i); @@ -135,10 +135,12 @@ class ManageImportExportCest { private function pasteSimpleList(\AcceptanceTester $i) { $i->waitForText('Paste the data into a text box'); $i->click('[data-automation-id="import-paste-method"]'); - $i->fillField('textarea#paste_input', - 'johndoe@example.com, John, Doe + $i->fillField( + 'textarea#paste_input', + 'johndoe@example.com, John, Doe janedoe@example.com, Jane, Doe - jamesdoe@example.com, James, Doe'); + jamesdoe@example.com, James, Doe' + ); } private function uploadCsvFile(\AcceptanceTester $i, $fileName = 'MailPoetImportList.csv') { diff --git a/mailpoet/tests/acceptance/Subscribers/ManageSubscribersCest.php b/mailpoet/tests/acceptance/Subscribers/ManageSubscribersCest.php index 7340b0eb69..b66f817dcf 100644 --- a/mailpoet/tests/acceptance/Subscribers/ManageSubscribersCest.php +++ b/mailpoet/tests/acceptance/Subscribers/ManageSubscribersCest.php @@ -31,7 +31,7 @@ class ManageSubscribersCest { $i->cli(['user', 'import-csv', '/wp-core/wp-content/plugins/mailpoet/tests/_data/users.csv']); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->seeNoJSErrors(); } @@ -76,14 +76,14 @@ class ManageSubscribersCest { $i->wantTo('Add a user to global subscribers list'); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->click('[data-automation-id="add-new-subscribers-button"]'); $i->fillField(['name' => 'email'], 'newglobaluser99@fakemail.fake'); $i->fillField(['name' => 'first_name'], 'New'); $i->fillField(['name' => 'last_name'], 'GlobalUser'); $i->selectOptionInSelect2($this->segment->getName()); $i->click('Save'); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->searchFor('newglobaluser99@fakemail.fake'); $i->waitForText('newglobaluser99@fakemail.fake'); $i->seeNoJSErrors(); @@ -172,7 +172,7 @@ class ManageSubscribersCest { $this->generateSingleSubscriber('addtolistuser99@fakemail.fake', 'Add', 'ToAList', $this->segment); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->waitForListingItemsToLoad(); $i->clickItemRowActionByItemName($newSubscriberEmail, 'Edit'); $i->waitForText('Subscriber'); @@ -211,7 +211,7 @@ class ManageSubscribersCest { $this->generateSingleSubscriber('deletefromlistuser99@fakemail.fake', 'Delete', 'FromAList', $this->segment); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->waitForListingItemsToLoad(); $i->clickItemRowActionByItemName($newSubscriberEmail, 'Edit'); $i->waitForText('Subscriber'); @@ -254,7 +254,7 @@ class ManageSubscribersCest { $this->generateSingleSubscriber('editglobaluser99@fakemail.fake', 'Edit', 'ThisGlobalUser', $this->segment); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); $i->waitForListingItemsToLoad(); $i->clickItemRowActionByItemName($newSubscriberEmail, 'Edit'); $i->waitForText('Subscriber'); @@ -312,7 +312,7 @@ class ManageSubscribersCest { $this->prepareInactiveSubscribersData(); $i->login(); - $i->amOnMailPoetPage ('Subscribers'); + $i->amOnMailPoetPage('Subscribers'); // Filter inactive subscribers $i->changeGroupInListingFilter('inactive'); diff --git a/mailpoet/tests/acceptance/Subscribers/ManageSubscriptionLinkCest.php b/mailpoet/tests/acceptance/Subscribers/ManageSubscriptionLinkCest.php index d79fe04f07..da05935fb3 100644 --- a/mailpoet/tests/acceptance/Subscribers/ManageSubscriptionLinkCest.php +++ b/mailpoet/tests/acceptance/Subscribers/ManageSubscriptionLinkCest.php @@ -43,9 +43,11 @@ class ManageSubscriptionLinkCest { $i->click(Locator::contains('span.subject', $this->newsletterTitle)); $i->switchToIframe('#preview-html'); $i->waitForElementChange( - \Codeception\Util\Locator::contains('a', 'Manage your subscription'), function ($el) { + \Codeception\Util\Locator::contains('a', 'Manage your subscription'), + function ($el) { return $el->getAttribute('target') === "_blank"; - }, 100 + }, + 100 ); $i->click('Manage your subscription'); $i->switchToNextTab(); @@ -141,9 +143,11 @@ class ManageSubscriptionLinkCest { $i->click(Locator::contains('span.subject', $this->newsletterTitle)); $i->switchToIframe('#preview-html'); $i->waitForElementChange( - \Codeception\Util\Locator::contains('a', 'Unsubscribe'), function ($el) { + \Codeception\Util\Locator::contains('a', 'Unsubscribe'), + function ($el) { return $el->getAttribute('target') === "_blank"; - }, 100 + }, + 100 ); $i->click('Unsubscribe'); $i->switchToNextTab(); diff --git a/mailpoet/tests/integration/API/JSON/v1/ImportExportTest.php b/mailpoet/tests/integration/API/JSON/v1/ImportExportTest.php index f357d31dd5..a17a54a6b6 100644 --- a/mailpoet/tests/integration/API/JSON/v1/ImportExportTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/ImportExportTest.php @@ -25,7 +25,7 @@ class ImportExportTest extends \MailPoetTest { $this->entityManager->createQueryBuilder() ->delete(ScheduledTaskEntity::class, 's') ->where('s.type = :type') - ->setParameter(':type', WooCommerceSync::TASK_TYPE ) + ->setParameter(':type', WooCommerceSync::TASK_TYPE) ->getQuery() ->execute(); } diff --git a/mailpoet/tests/integration/API/JSON/v1/NewslettersTest.php b/mailpoet/tests/integration/API/JSON/v1/NewslettersTest.php index 2b0ed2576a..ecd5e4bc86 100644 --- a/mailpoet/tests/integration/API/JSON/v1/NewslettersTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/NewslettersTest.php @@ -244,12 +244,10 @@ class NewslettersTest extends \MailPoetTest { public function testItCanSetANewsletterStatus() { // set status to sending - $response = $this->endpoint->setStatus - ([ + $response = $this->endpoint->setStatus([ 'id' => $this->newsletter->getId(), 'status' => NewsletterEntity::STATUS_SENDING, - ] - ); + ]); verify($response->status)->equals(APIResponse::STATUS_OK); verify($response->data['status'])->equals(NewsletterEntity::STATUS_SENDING); diff --git a/mailpoet/tests/integration/API/JSON/v1/ServicesTest.php b/mailpoet/tests/integration/API/JSON/v1/ServicesTest.php index a5dbc26953..c4afce4086 100644 --- a/mailpoet/tests/integration/API/JSON/v1/ServicesTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/ServicesTest.php @@ -98,7 +98,9 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkMSSKey($this->data); verify($response->status)->equals(APIResponse::STATUS_NOT_FOUND); $errorMessage = $this->invokeMethod( - $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNAVAILABLE] + $servicesEndpoint, + 'getErrorDescriptionByCode', + [Bridge::CHECK_ERROR_UNAVAILABLE] ); $this->assertIsString($errorMessage); verify($response->errors[0]['message'])->stringContainsString($errorMessage); @@ -117,7 +119,9 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkMSSKey($this->data); verify($response->status)->equals(APIResponse::STATUS_NOT_FOUND); $errorMessage = $this->invokeMethod( - $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNKNOWN] + $servicesEndpoint, + 'getErrorDescriptionByCode', + [Bridge::CHECK_ERROR_UNKNOWN] ); $this->assertIsString($errorMessage); verify($response->errors[0]['message'])->stringContainsString($errorMessage); @@ -308,7 +312,9 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkPremiumKey($this->data); verify($response->status)->equals(APIResponse::STATUS_NOT_FOUND); $errorMessage = $this->invokeMethod( - $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNAVAILABLE] + $servicesEndpoint, + 'getErrorDescriptionByCode', + [Bridge::CHECK_ERROR_UNAVAILABLE] ); $this->assertIsString($errorMessage); verify($response->errors[0]['message'])->stringContainsString($errorMessage); @@ -327,7 +333,9 @@ class ServicesTest extends \MailPoetTest { $response = $servicesEndpoint->checkPremiumKey($this->data); verify($response->status)->equals(APIResponse::STATUS_NOT_FOUND); $errorMessage = $this->invokeMethod( - $servicesEndpoint, 'getErrorDescriptionByCode', [Bridge::CHECK_ERROR_UNKNOWN] + $servicesEndpoint, + 'getErrorDescriptionByCode', + [Bridge::CHECK_ERROR_UNKNOWN] ); $this->assertIsString($errorMessage); verify($response->errors[0]['message'])->stringContainsString($errorMessage); diff --git a/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php b/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php index a7a21aebd1..b9f747ea84 100644 --- a/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/SettingsTest.php @@ -57,7 +57,7 @@ class SettingsTest extends \MailPoetTest { $this->endpoint = new Settings( $this->settings, new Bridge, - $this->make(AuthorizedEmailsController::class, ['onSettingsSave' => null ]), + $this->make(AuthorizedEmailsController::class, ['onSettingsSave' => null]), $this->diContainer->get(AuthorizedSenderDomainController::class), $this->make(TransactionalEmails::class), WPFunctions::get(), diff --git a/mailpoet/tests/integration/API/JSON/v1/SubscribersTest.php b/mailpoet/tests/integration/API/JSON/v1/SubscribersTest.php index 85de95d3b3..53952274a8 100644 --- a/mailpoet/tests/integration/API/JSON/v1/SubscribersTest.php +++ b/mailpoet/tests/integration/API/JSON/v1/SubscribersTest.php @@ -567,7 +567,8 @@ class SubscribersTest extends \MailPoetTest { $foundSubscriberIds = array_map( function (array $data): int { return (int)$data['id']; - }, $data['data'] + }, + $data['data'] ); self::assertTrue(in_array((int)$this->subscriber1->getId(), $foundSubscriberIds, true), 'Subscriber 1 was not found.'); self::assertTrue(in_array((int)$subscriber->getId(), $foundSubscriberIds, true), 'New subscriber without list was not found.'); diff --git a/mailpoet/tests/integration/API/MP/APITest.php b/mailpoet/tests/integration/API/MP/APITest.php index 40bc02e98c..64185a6f0f 100644 --- a/mailpoet/tests/integration/API/MP/APITest.php +++ b/mailpoet/tests/integration/API/MP/APITest.php @@ -53,7 +53,6 @@ class APITest extends \MailPoetTest { [ 2, ], - ] - ); + ]); } } diff --git a/mailpoet/tests/integration/API/MP/SubscribersTest.php b/mailpoet/tests/integration/API/MP/SubscribersTest.php index a8982192bb..f3ef4cd366 100644 --- a/mailpoet/tests/integration/API/MP/SubscribersTest.php +++ b/mailpoet/tests/integration/API/MP/SubscribersTest.php @@ -81,7 +81,7 @@ class SubscribersTest extends \MailPoetTest { public function testItDoesNotSubscribeMissingSubscriberToLists() { try { - $this->getApi()->subscribeToLists(false, [1,2,3]); + $this->getApi()->subscribeToLists(false, [1, 2, 3]); $this->fail('Subscriber does not exist exception should have been thrown.'); } catch (\Exception $e) { verify($e->getMessage())->equals('A subscriber is required.'); @@ -92,7 +92,7 @@ class SubscribersTest extends \MailPoetTest { $subscriber = $this->subscriberFactory->create(); // multiple lists error message try { - $this->getApi()->subscribeToLists($subscriber->getId(), [1,2,3]); + $this->getApi()->subscribeToLists($subscriber->getId(), [1, 2, 3]); $this->fail('Missing segments exception should have been thrown.'); } catch (\Exception $e) { verify($e->getMessage())->equals('These lists do not exist.'); @@ -249,7 +249,8 @@ class SubscribersTest extends \MailPoetTest { 'subscribersResponseBuilder' => $this->diContainer->get(SubscribersResponseBuilder::class), 'settings' => SettingsController::getInstance(), ], - $this); + $this + ); $API = $this->getApi($subscribers); $API->subscribeToLists($subscriber->getId(), [$segment->getId()], ['skip_subscriber_notification' => true]); @@ -273,7 +274,8 @@ class SubscribersTest extends \MailPoetTest { 'subscribersResponseBuilder' => $this->diContainer->get(SubscribersResponseBuilder::class), 'settings' => SettingsController::getInstance(), ], - $this); + $this + ); $API = $this->getApi($subscribers); @@ -351,7 +353,7 @@ class SubscribersTest extends \MailPoetTest { public function testItDoesNotUnsubscribeWhenSubscriberIdNotPassedFromLists() { try { - $this->getApi()->unsubscribeFromLists(false, [1,2,3]); + $this->getApi()->unsubscribeFromLists(false, [1, 2, 3]); $this->fail('Subscriber does not exist exception should have been thrown.'); } catch (\Exception $e) { verify($e->getMessage())->equals('A subscriber is required.'); @@ -360,7 +362,7 @@ class SubscribersTest extends \MailPoetTest { public function testItDoesNotUnsubscribeMissingSubscriberFromLists() { try { - $this->getApi()->unsubscribeFromLists('asdf', [1,2,3]); + $this->getApi()->unsubscribeFromLists('asdf', [1, 2, 3]); $this->fail('Subscriber does not exist exception should have been thrown.'); } catch (\Exception $e) { verify($e->getMessage())->equals('This subscriber does not exist.'); @@ -371,7 +373,7 @@ class SubscribersTest extends \MailPoetTest { $subscriber = $this->subscriberFactory->create(); // multiple lists error message try { - $this->getApi()->unsubscribeFromLists($subscriber->getId(), [1,2,3]); + $this->getApi()->unsubscribeFromLists($subscriber->getId(), [1, 2, 3]); $this->fail('Missing segments exception should have been thrown.'); } catch (\Exception $e) { verify($e->getMessage())->equals('These lists do not exist.'); @@ -587,7 +589,8 @@ class SubscribersTest extends \MailPoetTest { 'settings' => $settings, 'requiredCustomFieldsValidator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), ], - $this); + $this + ); $API = Stub::make( API::class, @@ -638,14 +641,17 @@ class SubscribersTest extends \MailPoetTest { 'subscribersResponseBuilder' => $this->diContainer->get(SubscribersResponseBuilder::class), 'settings' => SettingsController::getInstance(), ], - $this); + $this + ); $API = Stub::makeEmptyExcept( API::class, 'addSubscriber', [ 'subscribers' => $subscribers, 'requiredCustomFieldValidator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), - ], $this); + ], + $this + ); $subscriber = [ 'email' => 'test@example.com', ]; @@ -665,14 +671,17 @@ class SubscribersTest extends \MailPoetTest { 'subscribersResponseBuilder' => $this->diContainer->get(SubscribersResponseBuilder::class), 'settings' => SettingsController::getInstance(), ], - $this); + $this + ); $API = Stub::makeEmptyExcept( API::class, 'addSubscriber', [ 'subscribers' => $subscribers, 'requiredCustomFieldValidator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), - ], $this); + ], + $this + ); $subscriber = [ 'email' => 'test@example.com', 'status' => SubscriberEntity::STATUS_SUBSCRIBED, @@ -698,7 +707,8 @@ class SubscribersTest extends \MailPoetTest { return []; }), ], - $this); + $this + ); $API = $this->makeEmptyExcept( API::class, 'addSubscriber', @@ -746,14 +756,17 @@ class SubscribersTest extends \MailPoetTest { 'subscribersResponseBuilder' => $this->diContainer->get(SubscribersResponseBuilder::class), 'settings' => SettingsController::getInstance(), ], - $this); + $this + ); $API = Stub::makeEmptyExcept( API::class, 'addSubscriber', [ 'subscribers' => $subscribers, 'requiredCustomFieldValidator' => Stub::makeEmpty(RequiredCustomFieldValidator::class, ['validate']), - ], $this); + ], + $this + ); $subscriber = [ 'email' => 'test@example.com', diff --git a/mailpoet/tests/integration/AutomaticEmails/WooCommerce/Events/PurchasedInCategoryTest.php b/mailpoet/tests/integration/AutomaticEmails/WooCommerce/Events/PurchasedInCategoryTest.php index 6eae4fc3b2..b893cbc0f6 100644 --- a/mailpoet/tests/integration/AutomaticEmails/WooCommerce/Events/PurchasedInCategoryTest.php +++ b/mailpoet/tests/integration/AutomaticEmails/WooCommerce/Events/PurchasedInCategoryTest.php @@ -258,7 +258,8 @@ class PurchasedInCategoryTest extends \MailPoetTest { 'option' => [ ['id' => '15'], ], - ]), + ] + ), ]); return $newsletter; } diff --git a/mailpoet/tests/integration/Automation/Integrations/MailPoet/Actions/SendEmailActionTest.php b/mailpoet/tests/integration/Automation/Integrations/MailPoet/Actions/SendEmailActionTest.php index 8e107ce4b5..2dee5988c9 100644 --- a/mailpoet/tests/integration/Automation/Integrations/MailPoet/Actions/SendEmailActionTest.php +++ b/mailpoet/tests/integration/Automation/Integrations/MailPoet/Actions/SendEmailActionTest.php @@ -322,7 +322,6 @@ class SendEmailActionTest extends \MailPoetTest { return $step->toArray(); }, $automation->getSteps() - ), ]; diff --git a/mailpoet/tests/integration/Config/RendererTest.php b/mailpoet/tests/integration/Config/RendererTest.php index 8e150237f6..f9165ad214 100644 --- a/mailpoet/tests/integration/Config/RendererTest.php +++ b/mailpoet/tests/integration/Config/RendererTest.php @@ -23,11 +23,12 @@ class RendererTest extends \MailPoetTest { } public function testItUsesCorrectAssetsManifestFilenames() { - $renderer = Stub::make(new Renderer( - false, - Env::$cachePath, - new TwigFileSystem(Env::$viewsPath) - ), + $renderer = Stub::make( + new Renderer( + false, + Env::$cachePath, + new TwigFileSystem(Env::$viewsPath) + ), ['getAssetManifest' => function($manifest) { return $manifest; }] @@ -117,7 +118,8 @@ class RendererTest extends \MailPoetTest { new TwigFileSystem(Env::$viewsPath), ], [ - 'renderer' => Stub::makeEmpty(TwigEnvironment::class, + 'renderer' => Stub::makeEmpty( + TwigEnvironment::class, [ 'load' => Expected::atLeastOnce( new TemplateWrapper($env, $template) diff --git a/mailpoet/tests/integration/Cron/Workers/BounceTest.php b/mailpoet/tests/integration/Cron/Workers/BounceTest.php index db7e463785..47392ba39d 100644 --- a/mailpoet/tests/integration/Cron/Workers/BounceTest.php +++ b/mailpoet/tests/integration/Cron/Workers/BounceTest.php @@ -183,7 +183,7 @@ class BounceTest extends \MailPoetTest { $this->entityManager->flush(); // create data that should be used for the current bounce task run $newsletter = $this->createNewsletter(); - $sendingTask = $this->createSendingTask() ; + $sendingTask = $this->createSendingTask(); $sendingTask->setCreatedAt(Carbon::now()->subDays(3)); $sendingTask->setUpdatedAt(Carbon::now()->subDays(3)); $this->createSendingQueue($newsletter, $sendingTask); diff --git a/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingErrorHandlerTest.php b/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingErrorHandlerTest.php index 3162449e7a..17d89cd19e 100644 --- a/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingErrorHandlerTest.php +++ b/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingErrorHandlerTest.php @@ -29,7 +29,8 @@ class SendingErrorHandlerTest extends \MailPoetTest { MailerError::OPERATION_SEND, MailerError::LEVEL_SOFT, 'Error Message', - null, $subscriberErrors + null, + $subscriberErrors ); $scheduledTaskSubscribersRepository = Stub::make( @@ -50,7 +51,8 @@ class SendingErrorHandlerTest extends \MailPoetTest { ); $errorHandler = $this->getServiceWithOverrides( - SendingErrorHandler::class, [ + SendingErrorHandler::class, + [ 'scheduledTaskSubscribersRepository' => $scheduledTaskSubscribersRepository, ] ); @@ -71,7 +73,8 @@ class SendingErrorHandlerTest extends \MailPoetTest { ); $errorHandler = $this->getServiceWithOverrides( - SendingErrorHandler::class, [ + SendingErrorHandler::class, + [ 'sendingQueuesRepository' => $sendingQueuesRepository, 'loggerFactory' => Stub::makeEmpty( LoggerFactory::class, diff --git a/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingQueueTest.php b/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingQueueTest.php index 6da27093f8..f9f31cec6b 100644 --- a/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingQueueTest.php +++ b/mailpoet/tests/integration/Cron/Workers/SendingQueue/SendingQueueTest.php @@ -204,7 +204,8 @@ class SendingQueueTest extends \MailPoetTest { 'enforceSendingAndExecutionLimits' => Expected::exactly(1, function() { throw new \Exception(); }), - ]); + ] + ); $sendingQueueWorker->__construct( $this->sendingErrorHandler, $this->sendingThrottlingHandler, @@ -237,7 +238,8 @@ class SendingQueueTest extends \MailPoetTest { $this->getSendingQueueWorker(), [ 'enforceSendingAndExecutionLimits' => Expected::exactly(1), - ]); + ] + ); $sendingQueueWorker->__construct( $this->sendingErrorHandler, $this->sendingThrottlingHandler, @@ -287,7 +289,8 @@ class SendingQueueTest extends \MailPoetTest { $this->getSendingQueueWorker(), [ 'enforceSendingAndExecutionLimits' => Expected::never(), - ]); + ] + ); $sendingQueueWorker->__construct( $this->sendingErrorHandler, $this->sendingThrottlingHandler, @@ -335,7 +338,8 @@ class SendingQueueTest extends \MailPoetTest { return (object)['status' => null, 'taskId' => 0]; }, 'enforceSendingAndExecutionLimits' => Expected::exactly(2), - ]); + ] + ); $sendingQueueWorker->__construct( $this->sendingErrorHandler, $this->sendingThrottlingHandler, @@ -1260,7 +1264,8 @@ class SendingQueueTest extends \MailPoetTest { public function testItPausesSendingTaskWhenSenderAddressDoesNotMeetRequirements() { $authorizedEmailControllerMock = $this->make( AuthorizedEmailsController::class, - ['isSenderAddressValid' => false]); + ['isSenderAddressValid' => false] + ); $this->newsletter->setStatus(NewsletterEntity::STATUS_SENDING); $this->entityManager->flush(); diff --git a/mailpoet/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php b/mailpoet/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php index 6fbf4c6b3f..2a0f2c32b0 100644 --- a/mailpoet/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php +++ b/mailpoet/tests/integration/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php @@ -134,7 +134,7 @@ class NewsletterTest extends \MailPoetTest { // draft or any other status return false $parentNewsletterEntity = $this->newslettersRepository->findOneById($this->parentNewsletter->getId()); $this->assertInstanceOf(NewsletterEntity::class, $parentNewsletterEntity); - $parentNewsletterEntity->setStatus( NewsletterEntity::STATUS_DRAFT); + $parentNewsletterEntity->setStatus(NewsletterEntity::STATUS_DRAFT); $this->newslettersRepository->persist($parentNewsletterEntity); $this->newslettersRepository->flush(); $newsletterEntity = $this->newslettersRepository->findOneById($this->newsletter->getId()); diff --git a/mailpoet/tests/integration/Cron/Workers/StatsNotifications/AutomatedEmailsTest.php b/mailpoet/tests/integration/Cron/Workers/StatsNotifications/AutomatedEmailsTest.php index 4ef9b1a9be..56399bffa5 100644 --- a/mailpoet/tests/integration/Cron/Workers/StatsNotifications/AutomatedEmailsTest.php +++ b/mailpoet/tests/integration/Cron/Workers/StatsNotifications/AutomatedEmailsTest.php @@ -163,7 +163,8 @@ class AutomatedEmailsTest extends \MailPoetTest { $this->anything(), $this->callback(function($context): bool { return (bool)strpos($context['linkSettings'], 'mailpoet-settings'); - })); + }) + ); $this->cronWorkerRunner->run($this->statsNotifications); } @@ -180,7 +181,8 @@ class AutomatedEmailsTest extends \MailPoetTest { && $context['newsletters'][0]['clicked'] === 50 && $context['newsletters'][0]['opened'] === 20 && $context['newsletters'][0]['subject'] === 'Subject'; - })); + }) + ); $this->cronWorkerRunner->run($this->statsNotifications); } diff --git a/mailpoet/tests/integration/Cron/Workers/StatsNotifications/WorkerTest.php b/mailpoet/tests/integration/Cron/Workers/StatsNotifications/WorkerTest.php index fb7a0bb62d..467c67df15 100644 --- a/mailpoet/tests/integration/Cron/Workers/StatsNotifications/WorkerTest.php +++ b/mailpoet/tests/integration/Cron/Workers/StatsNotifications/WorkerTest.php @@ -171,11 +171,12 @@ class WorkerTest extends \MailPoetTest { public function testAddsSubjectToContext() { $this->renderer->expects($this->exactly(2)) // html + text template ->method('render') - ->with( - $this->anything(), - $this->callback(function($context){ + ->with( + $this->anything(), + $this->callback(function($context){ return $context['subject'] === 'Rendered Email Subject'; - })); + }) + ); $this->statsNotifications->process(); } @@ -184,10 +185,11 @@ class WorkerTest extends \MailPoetTest { $this->renderer->expects($this->exactly(2)) // html + text template ->method('render') ->with( - $this->anything(), - $this->callback(function($context){ - return $context['preheader'] === '60.00% clicks, 40.00% opens, 20.00% unsubscribes in a nutshell.'; - })); + $this->anything(), + $this->callback(function($context){ + return $context['preheader'] === '60.00% clicks, 40.00% opens, 20.00% unsubscribes in a nutshell.'; + }) + ); $this->statsNotifications->process(); } @@ -200,7 +202,8 @@ class WorkerTest extends \MailPoetTest { $this->callback(function($context){ return strpos($context['linkSettings'], 'mailpoet-settings') && strpos($context['linkStats'], 'mailpoet-newsletters&stats'); - })); + }) + ); $this->statsNotifications->process(); } @@ -213,7 +216,8 @@ class WorkerTest extends \MailPoetTest { $this->callback(function($context){ return ($context['topLink'] === 'Link url2') && ($context['topLinkClicks'] === 2); - })); + }) + ); $this->statsNotifications->process(); } @@ -239,7 +243,8 @@ class WorkerTest extends \MailPoetTest { $this->anything(), $this->callback(function($context){ return ($context['topLink'] === 'Manage subscription link'); - })); + }) + ); $this->statsNotifications->process(); } diff --git a/mailpoet/tests/integration/Doctrine/EventListeners/EmojiEncodingListenerTest.php b/mailpoet/tests/integration/Doctrine/EventListeners/EmojiEncodingListenerTest.php index 27c3c180d6..e21154ab3f 100644 --- a/mailpoet/tests/integration/Doctrine/EventListeners/EmojiEncodingListenerTest.php +++ b/mailpoet/tests/integration/Doctrine/EventListeners/EmojiEncodingListenerTest.php @@ -9,7 +9,7 @@ use MailPoetVendor\Doctrine\ORM\Events; class EmojiEncodingListenerTest extends \MailPoetTest { public function testItSanitizeFormEntityOnPersistAndUpdate() { - $form = new FormEntity('Form' ); + $form = new FormEntity('Form'); $form->setBody(['body']); $emojiMock = $this->createMock(Emoji::class); $emojiMock->expects($this->exactly(2)) diff --git a/mailpoet/tests/integration/Logging/LogHandlerTest.php b/mailpoet/tests/integration/Logging/LogHandlerTest.php index 4985760e00..0875f7303c 100644 --- a/mailpoet/tests/integration/Logging/LogHandlerTest.php +++ b/mailpoet/tests/integration/Logging/LogHandlerTest.php @@ -42,7 +42,7 @@ class LogHandlerTest extends \MailPoetTest { public function testItPurgesOldLogs() { $entity = new LogEntity(); - $entity->setName( 'old name'); + $entity->setName('old name'); $entity->setLevel(5); $entity->setMessage('xyz'); $entity->setCreatedAt(Carbon::now()->subDays(100)); @@ -73,7 +73,7 @@ class LogHandlerTest extends \MailPoetTest { public function testItNotPurgesOldLogs() { $entity = new LogEntity(); - $entity->setName( 'old name keep'); + $entity->setName('old name keep'); $entity->setLevel(5); $entity->setMessage('xyz'); $entity->setCreatedAt(Carbon::now()->subDays(100)); diff --git a/mailpoet/tests/integration/Mailer/MailerTest.php b/mailpoet/tests/integration/Mailer/MailerTest.php index b0c74a1403..941253c80a 100644 --- a/mailpoet/tests/integration/Mailer/MailerTest.php +++ b/mailpoet/tests/integration/Mailer/MailerTest.php @@ -52,33 +52,33 @@ class MailerTest extends \MailPoetTest { verify($mailer->formatSubscriberNameAndEmailAddress( [ 'email' => 'test@email.com', - ]) - )->equals('test@email.com'); + ] + ))->equals('test@email.com'); verify($mailer->formatSubscriberNameAndEmailAddress( [ 'first_name' => 'First', 'email' => 'test@email.com', - ]) - )->equals('First '); + ] + ))->equals('First '); verify($mailer->formatSubscriberNameAndEmailAddress( [ 'last_name' => 'Last', 'email' => 'test@email.com', - ]) - )->equals('Last '); + ] + ))->equals('Last '); verify($mailer->formatSubscriberNameAndEmailAddress( [ 'first_name' => 'First', 'last_name' => 'Last', 'email' => 'test@email.com', - ]) - )->equals('First Last '); + ] + ))->equals('First Last '); verify($mailer->formatSubscriberNameAndEmailAddress( [ 'full_name' => 'First Last', 'email' => 'test@email.com', - ]) - )->equals('First Last '); + ] + ))->equals('First Last '); $subscriber = (new SubscriberFactory()) ->withFirstName('First') diff --git a/mailpoet/tests/integration/Mailer/Methods/AmazonSESTest.php b/mailpoet/tests/integration/Mailer/Methods/AmazonSESTest.php index 4fffdfbbf6..07980f9a10 100644 --- a/mailpoet/tests/integration/Mailer/Methods/AmazonSESTest.php +++ b/mailpoet/tests/integration/Mailer/Methods/AmazonSESTest.php @@ -169,8 +169,9 @@ class AmazonSESTest extends \MailPoetTest { 'x-amz-date:' . $this->mailer->date, '', 'host;x-amz-date', - hash($this->mailer->hashAlgorithm, - urldecode(http_build_query($body)) + hash( + $this->mailer->hashAlgorithm, + urldecode(http_build_query($body)) ), ] ); diff --git a/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php b/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php index 656114b306..86b6b898b6 100644 --- a/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php +++ b/mailpoet/tests/integration/Mailer/Methods/MailPoetAPITest.php @@ -167,19 +167,22 @@ class MailPoetAPITest extends \MailPoetTest { [ 'email' => 'test@test.com', 'name' => '', - ]); + ] + ); verify($this->mailer->processSubscriber('First ')) ->equals( [ 'email' => 'test@test.com', 'name' => 'First', - ]); + ] + ); verify($this->mailer->processSubscriber('First Last ')) ->equals( [ 'email' => 'test@test.com', 'name' => 'First Last', - ]); + ] + ); } public function testItWillNotSendIfApiKeyIsMarkedInvalid() { diff --git a/mailpoet/tests/integration/Mailer/Methods/PHPMailTest.php b/mailpoet/tests/integration/Mailer/Methods/PHPMailTest.php index 2bd31310b6..003da2f5e0 100644 --- a/mailpoet/tests/integration/Mailer/Methods/PHPMailTest.php +++ b/mailpoet/tests/integration/Mailer/Methods/PHPMailTest.php @@ -117,17 +117,20 @@ class PHPMailTest extends \MailPoetTest { [ 'email' => 'test@test.com', 'name' => '', - ]); + ] + ); verify($this->mailer->processSubscriber('First '))->equals( [ 'email' => 'test@test.com', 'name' => 'First', - ]); + ] + ); verify($this->mailer->processSubscriber('First Last '))->equals( [ 'email' => 'test@test.com', 'name' => 'First Last', - ]); + ] + ); } public function testItChecksBlacklistBeforeSending() { diff --git a/mailpoet/tests/integration/Migrations/App/Migration_20221028_105818_App_Test.php b/mailpoet/tests/integration/Migrations/App/Migration_20221028_105818_App_Test.php index 96944bf2d2..dd4386c955 100644 --- a/mailpoet/tests/integration/Migrations/App/Migration_20221028_105818_App_Test.php +++ b/mailpoet/tests/integration/Migrations/App/Migration_20221028_105818_App_Test.php @@ -28,7 +28,7 @@ class Migration_20221028_105818_App_Test extends \MailPoetTest { public function testItDoesNotUpdateInactiveSubscribersFrequencyValuesOtherThanThePreviousDefault() { $this->settings->delete('deactivate_subscriber_after_inactive_days'); - $nonDefaultOptions = [ '', '90', '365' ]; + $nonDefaultOptions = ['', '90', '365']; foreach ($nonDefaultOptions as $option) { $this->settings->set('db_version', '3.78.0'); $this->settings->set('deactivate_subscriber_after_inactive_days', $option); diff --git a/mailpoet/tests/integration/Migrations/DbIndexesTest.php b/mailpoet/tests/integration/Migrations/DbIndexesTest.php index 0d9c2a8d58..6b1dd14c1d 100644 --- a/mailpoet/tests/integration/Migrations/DbIndexesTest.php +++ b/mailpoet/tests/integration/Migrations/DbIndexesTest.php @@ -14,7 +14,8 @@ class DbIndexesTest extends \MailPoetTest { */ public function testDbHasCorrectUniqueVarcharIndexes() { $connection = $this->diContainer->get(Connection::class); - $incorrectIndexes = $connection->executeQuery("SELECT DISTINCT + $incorrectIndexes = $connection->executeQuery( + "SELECT DISTINCT ISS.TABLE_NAME, ISS.INDEX_NAME, ISS.COLUMN_NAME, diff --git a/mailpoet/tests/integration/Newsletter/AutomatedLatestContentAPITest.php b/mailpoet/tests/integration/Newsletter/AutomatedLatestContentAPITest.php index d87e9f3cbd..b9b3183a73 100644 --- a/mailpoet/tests/integration/Newsletter/AutomatedLatestContentAPITest.php +++ b/mailpoet/tests/integration/Newsletter/AutomatedLatestContentAPITest.php @@ -128,7 +128,7 @@ class AutomatedLatestContentAPITest extends \MailPoetTest { wp_delete_user($existingUser->ID); } - wp_insert_user( [ + wp_insert_user([ 'user_login' => $username, 'user_email' => $email, 'user_pass' => '', diff --git a/mailpoet/tests/integration/Newsletter/Links/LinksTest.php b/mailpoet/tests/integration/Newsletter/Links/LinksTest.php index b6daa889fe..a6b0d2d430 100644 --- a/mailpoet/tests/integration/Newsletter/Links/LinksTest.php +++ b/mailpoet/tests/integration/Newsletter/Links/LinksTest.php @@ -221,7 +221,8 @@ class LinksTest extends \MailPoetTest { $tableName = $this->entityManager->getClassMetadata(NewsletterLinkEntity::class)->getTableName(); $this->entityManager->getConnection() ->executeStatement( - "UPDATE $tableName SET queue_id = 2 WHERE id = ?", [$newsletterLink1->getId()] + "UPDATE $tableName SET queue_id = 2 WHERE id = ?", + [$newsletterLink1->getId()] ); $this->newsletterLinkFactory diff --git a/mailpoet/tests/integration/Newsletter/RendererTest.php b/mailpoet/tests/integration/Newsletter/RendererTest.php index a4c59670c9..d1ac18207d 100644 --- a/mailpoet/tests/integration/Newsletter/RendererTest.php +++ b/mailpoet/tests/integration/Newsletter/RendererTest.php @@ -45,7 +45,8 @@ class RendererTest extends \MailPoetTest { parent::_before(); $this->newsletter = new NewsletterEntity(); $body = json_decode( - (string)file_get_contents(dirname(__FILE__) . '/RendererTestData.json'), true + (string)file_get_contents(dirname(__FILE__) . '/RendererTestData.json'), + true ); $this->assertIsArray($body); $this->newsletter->setBody($body); @@ -463,7 +464,8 @@ class RendererTest extends \MailPoetTest { preg_match( '/border-top-width: 3px/', $DOM('tr > td.mailpoet_divider > table > tr > td.mailpoet_divider-cell', 0)->attr('style') - ))->equals(1); + ) + )->equals(1); } public function testItRendersSpacer() { @@ -504,27 +506,32 @@ class RendererTest extends \MailPoetTest { verify( preg_match( '/line-height: 30px/', - $DOM('a.mailpoet_button', 0)->attr('style')) + $DOM('a.mailpoet_button', 0)->attr('style') + ) )->equals(1); verify( preg_match( '/arcsize="' . round(20 / 30 * 100) . '%"/', - $DOM('tr > td > div > table > tr > td', 0)->text()) + $DOM('tr > td > div > table > tr > td', 0)->text() + ) )->equals(1); verify( preg_match( '/style="height:30px.*?width:98px/', - $DOM('tr > td > div > table > tr > td', 0)->text()) + $DOM('tr > td > div > table > tr > td', 0)->text() + ) )->equals(1); verify( preg_match( '/style="color:#ffffff.*?font-family:Arial.*?font-size:14px/', - $DOM('tr > td > div > table > tr > td', 0)->text()) + $DOM('tr > td > div > table > tr > td', 0)->text() + ) )->equals(1); verify( preg_match( '/fillcolor="#666666/', - $DOM('tr > td > div > table > tr > td', 0)->text()) + $DOM('tr > td > div > table > tr > td', 0)->text() + ) )->equals(1); } @@ -666,7 +673,8 @@ class RendererTest extends \MailPoetTest { set_post_thumbnail($postId, $attachmentId); $body = json_decode( - (string)file_get_contents(dirname(__FILE__) . '/RendererTestALCdata.json'), true + (string)file_get_contents(dirname(__FILE__) . '/RendererTestALCdata.json'), + true ); $this->assertIsArray($body); $this->newsletter->setBody($body); @@ -701,8 +709,8 @@ class RendererTest extends \MailPoetTest { } public function makeAttachment($upload, $parentPostId = 0) { - if (!function_exists( 'wp_crop_image' )) { - include( ABSPATH . 'wp-admin/includes/image.php' ); + if (!function_exists('wp_crop_image')) { + include(ABSPATH . 'wp-admin/includes/image.php'); } if (!empty($upload['type'])) { diff --git a/mailpoet/tests/integration/Newsletter/Scheduler/PostNotificationTest.php b/mailpoet/tests/integration/Newsletter/Scheduler/PostNotificationTest.php index dd48a0debd..794fb3e521 100644 --- a/mailpoet/tests/integration/Newsletter/Scheduler/PostNotificationTest.php +++ b/mailpoet/tests/integration/Newsletter/Scheduler/PostNotificationTest.php @@ -403,7 +403,8 @@ class PostNotificationTest extends \MailPoetTest { $task = (new ScheduledTask())->create( SendingQueue::TASK_TYPE, - SendingQueueEntity::STATUS_SCHEDULED, Carbon::now() + SendingQueueEntity::STATUS_SCHEDULED, + Carbon::now() ->addDay() ); diff --git a/mailpoet/tests/integration/Newsletter/ShortcodesTest.php b/mailpoet/tests/integration/Newsletter/ShortcodesTest.php index 23d9655f25..ca5bfdf81d 100644 --- a/mailpoet/tests/integration/Newsletter/ShortcodesTest.php +++ b/mailpoet/tests/integration/Newsletter/ShortcodesTest.php @@ -111,7 +111,9 @@ class ShortcodesTest extends \MailPoetTest { verify($arguments['arg1'])->equals('val1'); verify($arguments['arg2'])->equals('val2'); if (strpos($shortcode, '[some:shortcode') === 0) return 'success'; - }, 10, 6 + }, + 10, + 6 ); $result = $shortcodesObject->process($shortcode); verify($result[0])->equals('success'); diff --git a/mailpoet/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php b/mailpoet/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php index 22699ef16c..cbe0815dc2 100644 --- a/mailpoet/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php +++ b/mailpoet/tests/integration/Newsletter/ViewInBrowser/ViewInBrowserRendererTest.php @@ -98,7 +98,9 @@ class ViewInBrowserRendererTest extends \MailPoetTest { } ] } - }', true); + }', + true + ); $this->queueRenderedNewsletterWithoutTracking = [ 'html' => '

Newsletter from queue. Hello, [subscriber:firstname | default:reader]. Unsubscribe or visit Google

', 'text' => 'test', diff --git a/mailpoet/tests/integration/NewsletterTemplates/ThumbnailSaverTest.php b/mailpoet/tests/integration/NewsletterTemplates/ThumbnailSaverTest.php index 70582d9e40..bf6aeaa584 100644 --- a/mailpoet/tests/integration/NewsletterTemplates/ThumbnailSaverTest.php +++ b/mailpoet/tests/integration/NewsletterTemplates/ThumbnailSaverTest.php @@ -21,7 +21,7 @@ class ThumbnailSaverTest extends \MailPoetTest { verify($thumbnailUrl)->isString(); verify($thumbnailUrl)->stringStartsWith(Env::$tempUrl); verify($thumbnailUrl)->stringContainsString(ThumbnailSaver::THUMBNAIL_DIRECTORY); - [,$fileName] = explode(ThumbnailSaver::THUMBNAIL_DIRECTORY, (string)$thumbnailUrl); + [, $fileName] = explode(ThumbnailSaver::THUMBNAIL_DIRECTORY, (string)$thumbnailUrl); $file = Env::$tempPath . '/' . ThumbnailSaver::THUMBNAIL_DIRECTORY . $fileName; verify(file_exists($file))->true(); unlink($file); // remove the file after the test @@ -37,7 +37,7 @@ class ThumbnailSaverTest extends \MailPoetTest { $thumbnailUrl = $template->getThumbnail(); verify($thumbnailUrl)->isString(); verify($thumbnailUrl)->stringStartsWith(Env::$tempUrl); - [,$fileName] = explode(ThumbnailSaver::THUMBNAIL_DIRECTORY, (string)$thumbnailUrl); + [, $fileName] = explode(ThumbnailSaver::THUMBNAIL_DIRECTORY, (string)$thumbnailUrl); // File is still the same verify($thumbnailUrl)->stringEndsWith($fileName); $file = Env::$tempPath . '/' . ThumbnailSaver::THUMBNAIL_DIRECTORY . $fileName; diff --git a/mailpoet/tests/integration/REST/Automation/Automations/AutomationsGetTest.php b/mailpoet/tests/integration/REST/Automation/Automations/AutomationsGetTest.php index f56433d22e..1d9dc5a5ff 100644 --- a/mailpoet/tests/integration/REST/Automation/Automations/AutomationsGetTest.php +++ b/mailpoet/tests/integration/REST/Automation/Automations/AutomationsGetTest.php @@ -145,13 +145,13 @@ class AutomationsGetTest extends AutomationTest { } private function createNewAutomation(array $data = []): int { - $rootStep = ['id' => 'root','type' => Step::TYPE_ROOT,'key' => 'core:root']; + $rootStep = ['id' => 'root', 'type' => Step::TYPE_ROOT, 'key' => 'core:root']; $data['name'] = $data['name'] ?? 'Test'; $data['steps'] = $data['steps'] ?? [$rootStep]; $data['author'] = $data['author'] ?? wp_get_current_user()->ID; $automation = new Automation( $data['name'], - array_map([$this,'createStep'], $data['steps']), + array_map([$this, 'createStep'], $data['steps']), new \WP_User((int)$data['author']) ); $automation->setStatus($data['status'] ?? Automation::STATUS_ACTIVE); diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/SubscriberDateFieldTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/SubscriberDateFieldTest.php index b026f04e51..dc27d50cc0 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/SubscriberDateFieldTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/SubscriberDateFieldTest.php @@ -126,7 +126,7 @@ class SubscriberDateFieldTest extends \MailPoetTest { ->withEmail('5@example.com') ->withLastPageViewAt(new CarbonImmutable('2023-07-15')) ->create(); - $this->assertFilterReturnsEmails('lastPageViewDate', 'onOrAfter', '2023-07-13', ['3@example.com','4@example.com', '5@example.com']); + $this->assertFilterReturnsEmails('lastPageViewDate', 'onOrAfter', '2023-07-13', ['3@example.com', '4@example.com', '5@example.com']); } public function testItWorksForNotOn(): void { diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceAverageSpentTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceAverageSpentTest.php index 4f423cb5ba..b3f236c153 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceAverageSpentTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceAverageSpentTest.php @@ -154,7 +154,7 @@ class WooCommerceAverageSpentTest extends \MailPoetTest { private function createCustomerWithOrderValues(string $customerEmail, array $values): void { $customerId = $this->tester->createCustomer($customerEmail); foreach ($values as $value) { - $this->createOrder($customerId, $value ); + $this->createOrder($customerId, $value); } } diff --git a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceCountryTest.php b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceCountryTest.php index d1d9e11c21..6da83a1343 100644 --- a/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceCountryTest.php +++ b/mailpoet/tests/integration/Segments/DynamicSegments/Filters/WooCommerceCountryTest.php @@ -38,13 +38,13 @@ class WooCommerceCountryTest extends \MailPoetTest { } public function testItAppliesFilterAny(): void { - $segmentFilterData = $this->getSegmentFilterData(['CZ','US']); + $segmentFilterData = $this->getSegmentFilterData(['CZ', 'US']); $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->wooCommerceCountryFilter); $this->assertEqualsCanonicalizing(['customer1@example.com', 'customer2@example.com', 'customer3@example.com'], $emails); } public function testItAppliesFilterNone(): void { - $segmentFilterData = $this->getSegmentFilterData(['CZ','US'], DynamicSegmentFilterData::OPERATOR_NONE); + $segmentFilterData = $this->getSegmentFilterData(['CZ', 'US'], DynamicSegmentFilterData::OPERATOR_NONE); $emails = $this->tester->getSubscriberEmailsMatchingDynamicFilter($segmentFilterData, $this->wooCommerceCountryFilter); $this->assertEqualsCanonicalizing(['customer4@example.com', 'customer5@example.com'], $emails); } diff --git a/mailpoet/tests/integration/Segments/WooCommerceTest.php b/mailpoet/tests/integration/Segments/WooCommerceTest.php index ce03c0a7ad..b0a6f013a6 100644 --- a/mailpoet/tests/integration/Segments/WooCommerceTest.php +++ b/mailpoet/tests/integration/Segments/WooCommerceTest.php @@ -773,8 +773,7 @@ class WooCommerceTest extends \MailPoetTest { $subscribersTable = $this->entityManager->getClassMetadata(SubscriberEntity::class)->getTableName(); $this->entityManager->getConnection()->executeQuery(' UPDATE ' . $subscribersTable . ' - SET `email` = "" WHERE `id` = ' . $subscriber->getId() - ); + SET `email` = "" WHERE `id` = ' . $subscriber->getId()); } private function createSubscriber( diff --git a/mailpoet/tests/integration/Services/AuthorizedEmailsControllerTest.php b/mailpoet/tests/integration/Services/AuthorizedEmailsControllerTest.php index 44b8c5cb64..c62efff34c 100644 --- a/mailpoet/tests/integration/Services/AuthorizedEmailsControllerTest.php +++ b/mailpoet/tests/integration/Services/AuthorizedEmailsControllerTest.php @@ -472,7 +472,7 @@ class AuthorizedEmailsControllerTest extends \MailPoetTest { public function testItThrowsAnExceptionForReturnedArrayForCreateNewAuthorizedEmailAddress() { $errorMessage = 'some errors'; $this->expectException(InvalidArgumentException::class); - $this->expectExceptionMessage($errorMessage ); + $this->expectExceptionMessage($errorMessage); $bridgeMock = $this->make(Bridge::class, [ 'getAuthorizedEmailAddresses' => Expected::once([]), diff --git a/mailpoet/tests/integration/Services/AuthorizedSenderDomainControllerTest.php b/mailpoet/tests/integration/Services/AuthorizedSenderDomainControllerTest.php index 9811f3376d..936f12473c 100644 --- a/mailpoet/tests/integration/Services/AuthorizedSenderDomainControllerTest.php +++ b/mailpoet/tests/integration/Services/AuthorizedSenderDomainControllerTest.php @@ -438,7 +438,7 @@ class AuthorizedSenderDomainControllerTest extends \MailPoetTest { $bridgeMock ?? $this->bridge, $newsletterStatisticsRepository, $this->settings, - $subscribersMock ?? $subscribers, + $subscribersMock ?? $subscribers, $this->wp ); } diff --git a/mailpoet/tests/integration/Services/BridgeTestMockAPI.php b/mailpoet/tests/integration/Services/BridgeTestMockAPI.php index a67462e717..816afc6f3f 100644 --- a/mailpoet/tests/integration/Services/BridgeTestMockAPI.php +++ b/mailpoet/tests/integration/Services/BridgeTestMockAPI.php @@ -83,7 +83,7 @@ class BridgeTestMockAPI extends API { $result = self::VERIFIED_DOMAIN_RESPONSE; $result['domain'] = 'mailpoet.com'; if ($domain === 'all') { - return [ $result ]; + return [$result]; } return $result; } diff --git a/mailpoet/tests/integration/Statistics/Track/ClicksTest.php b/mailpoet/tests/integration/Statistics/Track/ClicksTest.php index fe0dedc800..a9ba4c2c34 100644 --- a/mailpoet/tests/integration/Statistics/Track/ClicksTest.php +++ b/mailpoet/tests/integration/Statistics/Track/ClicksTest.php @@ -509,7 +509,8 @@ class ClicksTest extends \MailPoetTest { $clicksRepository = $this->diContainer->get(StatisticsClicksRepository::class); $data = $this->trackData; $data->userAgent = 'User Agent'; - $subscribersRepository = $this->getServiceWithOverrides(SubscribersRepository::class, + $subscribersRepository = $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, @@ -552,7 +553,8 @@ class ClicksTest extends \MailPoetTest { $clicksRepository = $this->diContainer->get(StatisticsClicksRepository::class); $data = $this->trackData; $data->userAgent = null; - $subscribersRepository = $this->getServiceWithOverrides(SubscribersRepository::class, + $subscribersRepository = $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, @@ -595,7 +597,8 @@ class ClicksTest extends \MailPoetTest { $clicksRepository = $this->diContainer->get(StatisticsClicksRepository::class); $data = $this->trackData; $data->userAgent = UserAgentEntity::MACHINE_USER_AGENTS[0]; - $subscribersRepository = $this->getServiceWithOverrides(SubscribersRepository::class, + $subscribersRepository = $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, diff --git a/mailpoet/tests/integration/Statistics/Track/OpensTest.php b/mailpoet/tests/integration/Statistics/Track/OpensTest.php index a1c1578c61..9aa02079cc 100644 --- a/mailpoet/tests/integration/Statistics/Track/OpensTest.php +++ b/mailpoet/tests/integration/Statistics/Track/OpensTest.php @@ -366,7 +366,8 @@ class OpensTest extends \MailPoetTest { $opens = Stub::construct($this->opens, [ $this->diContainer->get(StatisticsOpensRepository::class), $this->diContainer->get(UserAgentsRepository::class), - $this->getServiceWithOverrides(SubscribersRepository::class, + $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, @@ -395,7 +396,8 @@ class OpensTest extends \MailPoetTest { $opens = Stub::construct($this->opens, [ $this->diContainer->get(StatisticsOpensRepository::class), $this->diContainer->get(UserAgentsRepository::class), - $this->getServiceWithOverrides(SubscribersRepository::class, + $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, @@ -424,7 +426,8 @@ class OpensTest extends \MailPoetTest { $opens = Stub::construct($this->opens, [ $this->diContainer->get(StatisticsOpensRepository::class), $this->diContainer->get(UserAgentsRepository::class), - $this->getServiceWithOverrides(SubscribersRepository::class, + $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($wpMock), 'wp' => $wpMock, diff --git a/mailpoet/tests/integration/Subscribers/ConfirmationEmailMailerTest.php b/mailpoet/tests/integration/Subscribers/ConfirmationEmailMailerTest.php index 27879d77d5..6e85aca579 100644 --- a/mailpoet/tests/integration/Subscribers/ConfirmationEmailMailerTest.php +++ b/mailpoet/tests/integration/Subscribers/ConfirmationEmailMailerTest.php @@ -299,7 +299,8 @@ class ConfirmationEmailMailerTest extends \MailPoetTest { $newsletterRepository->flush(); $settings = SettingsController::getInstance(); - $settings->set(ConfirmationEmailCustomizer::SETTING_ENABLE_EMAIL_CUSTOMIZER, + $settings->set( + ConfirmationEmailCustomizer::SETTING_ENABLE_EMAIL_CUSTOMIZER, true ); $settings->set(ConfirmationEmailCustomizer::SETTING_EMAIL_ID, $newsletter->getId()); diff --git a/mailpoet/tests/integration/Subscribers/EngagementDataBackfillerTest.php b/mailpoet/tests/integration/Subscribers/EngagementDataBackfillerTest.php index 127e3b28ae..b888f7414f 100644 --- a/mailpoet/tests/integration/Subscribers/EngagementDataBackfillerTest.php +++ b/mailpoet/tests/integration/Subscribers/EngagementDataBackfillerTest.php @@ -54,7 +54,7 @@ class EngagementDataBackfillerTest extends \MailPoetTest { $data = $this->backfiller->getPurchaseDataForBatch($subscriberIds); $this->assertInstanceOf(SubscriberEntity::class, $sub1); $this->assertInstanceOf(SubscriberEntity::class, $sub2); - verify($data[$sub1->getId()]['last_purchase_at'])->equals( (string)$newer); + verify($data[$sub1->getId()]['last_purchase_at'])->equals((string)$newer); verify($data[$sub2->getId()]['last_purchase_at'])->equals((string)$newer2); verify(!isset($data[$customerId3]))->true(); } diff --git a/mailpoet/tests/integration/Subscribers/ImportExport/Export/ExportTest.php b/mailpoet/tests/integration/Subscribers/ImportExport/Export/ExportTest.php index d8693c1630..4de3f315a3 100644 --- a/mailpoet/tests/integration/Subscribers/ImportExport/Export/ExportTest.php +++ b/mailpoet/tests/integration/Subscribers/ImportExport/Export/ExportTest.php @@ -177,14 +177,18 @@ class ExportTest extends \MailPoetTest { '|' . preg_quote(Env::$tempPath, '|') . '/MailPoet_export_[a-z0-9]{15}.' . $this->export->exportFormatOption . - '|', $this->export->exportFile) + '|', + $this->export->exportFile + ) )->equals(1); verify( preg_match( '|' . preg_quote(Env::$tempUrl, '|') . '/' . basename($this->export->exportFile) . - '|', $this->export->exportFileURL) + '|', + $this->export->exportFileURL + ) )->equals(1); } diff --git a/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php b/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php index a6f2a8e606..d1b7fd3c5b 100644 --- a/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php +++ b/mailpoet/tests/integration/Subscribers/ImportExport/Import/ImportTest.php @@ -440,7 +440,8 @@ class ImportTest extends \MailPoetTest { [ 'one', 'two', - ]); + ] + ); } public function testItGetsCustomSubscribersFields(): void { diff --git a/mailpoet/tests/integration/Subscribers/ImportExport/ImportExportFactoryTest.php b/mailpoet/tests/integration/Subscribers/ImportExport/ImportExportFactoryTest.php index b779661311..5b6bb8dffe 100644 --- a/mailpoet/tests/integration/Subscribers/ImportExport/ImportExportFactoryTest.php +++ b/mailpoet/tests/integration/Subscribers/ImportExport/ImportExportFactoryTest.php @@ -219,7 +219,8 @@ class ImportExportFactoryTest extends \MailPoetTest { $importExportFactory->getSubscriberCustomFields() ), ], - ]); + ] + ); $formattedFieldsForSelect2 = $importExportFactory->formatFieldsForSelect2( $importExportFactory->getSubscriberFields(), $importExportFactory->getSubscriberCustomFields() @@ -269,7 +270,8 @@ class ImportExportFactoryTest extends \MailPoetTest { $importExportFactory->getSubscriberCustomFields() ), ], - ]); + ] + ); $formattedFieldsForSelect2 = $importExportFactory->formatFieldsForSelect2( $importExportFactory->getSubscriberFields(), $importExportFactory->getSubscriberCustomFields() diff --git a/mailpoet/tests/integration/Subscription/PagesTest.php b/mailpoet/tests/integration/Subscription/PagesTest.php index b04554cbd0..6cdf7502f0 100644 --- a/mailpoet/tests/integration/Subscription/PagesTest.php +++ b/mailpoet/tests/integration/Subscription/PagesTest.php @@ -256,7 +256,7 @@ class PagesTest extends \MailPoetTest { verify($updatedSubscriber->getStatus())->equals(SubscriberEntity::STATUS_UNSUBSCRIBED); $unsubscriptionStat = $this->statisticsUnsubscribesRepository->findOneBy(['subscriber' => $updatedSubscriber->getId()]); - verify($unsubscriptionStat->getMethod())->equals( StatisticsUnsubscribeEntity::METHOD_LINK); + verify($unsubscriptionStat->getMethod())->equals(StatisticsUnsubscribeEntity::METHOD_LINK); verify($unsubscriptionStat->getSource())->equals(StatisticsUnsubscribeEntity::SOURCE_NEWSLETTER); $this->statisticsUnsubscribesRepository->remove($unsubscriptionStat); diff --git a/mailpoet/tests/integration/WPCOM/DotcomLicenseProvisionerTest.php b/mailpoet/tests/integration/WPCOM/DotcomLicenseProvisionerTest.php index 38332edbac..9d53103b39 100644 --- a/mailpoet/tests/integration/WPCOM/DotcomLicenseProvisionerTest.php +++ b/mailpoet/tests/integration/WPCOM/DotcomLicenseProvisionerTest.php @@ -21,7 +21,8 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { $this->make(Settings::class), $this->make(Services::class), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => true]), - ]); + ] + ); } public function testItReturnsResultIfNotAtomic() { @@ -34,7 +35,8 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { $this->make(Settings::class), $this->make(Services::class), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => false]), - ]); + ] + ); verify($provisioner->provisionLicense($result, $payload, DotcomLicenseProvisioner::EVENT_TYPE_PROVISION_LICENSE))->equals($result); } @@ -65,7 +67,8 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { $this->make(Settings::class, ['setKeyAndSetupMss' => new ErrorResponse(['error' => 'some-error'])]), $this->make(Services::class, ['refreshMSSKeyStatus' => new SuccessResponse()]), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => true]), - ]); + ] + ); $error = $provisioner->provisionLicense($result, $payload, $eventType); $this->assertInstanceOf(\WP_Error::class, $error); verify($error->get_error_message())->equals('some-error '); @@ -82,7 +85,8 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { $this->make(Settings::class, ['setKeyAndSetupMss' => new SuccessResponse()]), $this->make(Services::class, ['refreshMSSKeyStatus' => new ErrorResponse(['error' => 'some-error'])]), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => true]), - ]); + ] + ); $error = $provisioner->provisionLicense($result, $payload, $eventType); $this->assertInstanceOf(\WP_Error::class, $error); verify($error->get_error_message())->equals('some-error '); @@ -97,13 +101,16 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { [ $this->diContainer->get(LoggerFactory::class), $this->make(Settings::class, ['setKeyAndSetupMss' => new SuccessResponse()]), - $this->make(Services::class, + $this->make( + Services::class, [ 'refreshMSSKeyStatus' => new SuccessResponse(), 'refreshPremiumKeyStatus' => new ErrorResponse(['error' => 'some-error']), - ]), + ] + ), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => true]), - ]); + ] + ); $error = $provisioner->provisionLicense($result, $payload, $eventType); $this->assertInstanceOf(\WP_Error::class, $error); verify($error->get_error_message())->equals('some-error '); @@ -118,13 +125,16 @@ class DotcomLicenseProvisionerTest extends \MailPoetTest { [ $this->diContainer->get(LoggerFactory::class), $this->make(Settings::class, ['setKeyAndSetupMss' => new SuccessResponse()]), - $this->make(Services::class, + $this->make( + Services::class, [ 'refreshMSSKeyStatus' => new SuccessResponse(), 'refreshPremiumKeyStatus' => new SuccessResponse(), - ]), + ] + ), $this->make(DotcomHelperFunctions::class, ['isAtomicPlatform' => true]), - ]); + ] + ); $result = $provisioner->provisionLicense($result, $payload, $eventType); verify($result)->equals(true); } diff --git a/mailpoet/tests/integration/WooCommerce/SubscriberEngagementTest.php b/mailpoet/tests/integration/WooCommerce/SubscriberEngagementTest.php index 305f250654..a9da5efbce 100644 --- a/mailpoet/tests/integration/WooCommerce/SubscriberEngagementTest.php +++ b/mailpoet/tests/integration/WooCommerce/SubscriberEngagementTest.php @@ -28,7 +28,8 @@ class SubscriberEngagementTest extends \MailPoetTest { public function _before() { $this->wooCommerceHelperMock = $this->createMock(Helper::class); $this->wpMock = $this->createMock(WPFunctions::class); - $subscribersRepository = $this->getServiceWithOverrides(SubscribersRepository::class, + $subscribersRepository = $this->getServiceWithOverrides( + SubscribersRepository::class, [ 'changesNotifier' => new SubscriberChangesNotifier($this->wpMock), 'wp' => $this->wpMock, diff --git a/mailpoet/tests/performance/tests/automation-analytics.js b/mailpoet/tests/performance/tests/automation-analytics.js index cb289367c4..25313e376b 100644 --- a/mailpoet/tests/performance/tests/automation-analytics.js +++ b/mailpoet/tests/performance/tests/automation-analytics.js @@ -31,7 +31,7 @@ export async function automationAnalytics() { // Go to the Automation Analytics page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-automation-analytics&id=142`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - automation - analytics & id = 142`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/automation-create-custom.js b/mailpoet/tests/performance/tests/automation-create-custom.js index c328983e2f..75fbdf09fd 100644 --- a/mailpoet/tests/performance/tests/automation-create-custom.js +++ b/mailpoet/tests/performance/tests/automation-create-custom.js @@ -39,7 +39,7 @@ export async function automationCreateCustom() { // Go to the Automations page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-automation-templates`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - automation - templates`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/automation-create-welcome.js b/mailpoet/tests/performance/tests/automation-create-welcome.js index a0da7f1763..4ea44b5b49 100644 --- a/mailpoet/tests/performance/tests/automation-create-welcome.js +++ b/mailpoet/tests/performance/tests/automation-create-welcome.js @@ -36,7 +36,7 @@ export async function automationCreateWelcome() { // Go to the Automations page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-automation-templates`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - automation - templates`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/automation-trash-restore.js b/mailpoet/tests/performance/tests/automation-trash-restore.js index f7d10c4c54..16b50df379 100644 --- a/mailpoet/tests/performance/tests/automation-trash-restore.js +++ b/mailpoet/tests/performance/tests/automation-trash-restore.js @@ -30,9 +30,12 @@ export async function automationTrashRestore() { await login(page); // Go to the Automations page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-automation`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - automation`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/automation-trigger-workflow.js b/mailpoet/tests/performance/tests/automation-trigger-workflow.js index d3528ee4f4..aed30ec5b9 100644 --- a/mailpoet/tests/performance/tests/automation-trigger-workflow.js +++ b/mailpoet/tests/performance/tests/automation-trigger-workflow.js @@ -36,7 +36,7 @@ export async function automationTriggerWorkflow() { // Go to the Add New Subscriber await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers#/new`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - subscribers# / new`, { waitUntil: 'networkidle', }, @@ -69,7 +69,7 @@ export async function automationTriggerWorkflow() { // Go to Scheduled Action to trigger the workflow await page.goto( - `${baseURL}/wp-admin/tools.php?page=action-scheduler&status=pending`, + `${baseURL} / wp - admin / tools.php ? page = action - scheduler & status = pending`, { waitUntil: 'networkidle', }, @@ -93,7 +93,7 @@ export async function automationTriggerWorkflow() { // Go to the Automation Analytics page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-automation-analytics&id=151&tab=automation-subscribers`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - automation - analytics & id = 151 & tab = automation - subscribers`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/forms-adding.js b/mailpoet/tests/performance/tests/forms-adding.js index d1326c493e..c79a977702 100644 --- a/mailpoet/tests/performance/tests/forms-adding.js +++ b/mailpoet/tests/performance/tests/forms-adding.js @@ -31,9 +31,12 @@ export async function formsAdding() { await login(page); // Go to the Forms page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-forms`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - forms`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/lists-complex-segment.js b/mailpoet/tests/performance/tests/lists-complex-segment.js index cd4f7f9a4a..ff8d7c64ee 100644 --- a/mailpoet/tests/performance/tests/lists-complex-segment.js +++ b/mailpoet/tests/performance/tests/lists-complex-segment.js @@ -34,9 +34,12 @@ export async function listsComplexSegment() { await login(page); // Go to the segments page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-segments`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - segments`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/lists-view-subscribers.js b/mailpoet/tests/performance/tests/lists-view-subscribers.js index 45a917527b..8711479dc5 100644 --- a/mailpoet/tests/performance/tests/lists-view-subscribers.js +++ b/mailpoet/tests/performance/tests/lists-view-subscribers.js @@ -32,9 +32,12 @@ export async function listsViewSubscribers() { await login(page); // Go to the Lists page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-lists`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - lists`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/newsletter-listing.js b/mailpoet/tests/performance/tests/newsletter-listing.js index 1a6f27003c..2658f601ec 100644 --- a/mailpoet/tests/performance/tests/newsletter-listing.js +++ b/mailpoet/tests/performance/tests/newsletter-listing.js @@ -31,9 +31,12 @@ export async function newsletterListing() { await login(page); // Go to the Emails page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-newsletters`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - newsletters`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/newsletter-searching.js b/mailpoet/tests/performance/tests/newsletter-searching.js index f1cf4347b5..f90d9efaba 100644 --- a/mailpoet/tests/performance/tests/newsletter-searching.js +++ b/mailpoet/tests/performance/tests/newsletter-searching.js @@ -31,9 +31,12 @@ export async function newsletterSearching() { await login(page); // Go to the Newsletters page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-newsletters`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - newsletters`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/newsletter-sending.js b/mailpoet/tests/performance/tests/newsletter-sending.js index 09430a3234..4391ba7b6e 100644 --- a/mailpoet/tests/performance/tests/newsletter-sending.js +++ b/mailpoet/tests/performance/tests/newsletter-sending.js @@ -32,9 +32,12 @@ export async function newsletterSending() { await login(page); // Go to the Emails page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-newsletters`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - newsletters`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/newsletter-statistics.js b/mailpoet/tests/performance/tests/newsletter-statistics.js index a064878022..ab44c66807 100644 --- a/mailpoet/tests/performance/tests/newsletter-statistics.js +++ b/mailpoet/tests/performance/tests/newsletter-statistics.js @@ -32,7 +32,7 @@ export async function newsletterStatistics() { // Go to the Newsletter Statistics page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-newsletters#/stats/2`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - newsletters# / stats / 2`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/onboarding-wizard.js b/mailpoet/tests/performance/tests/onboarding-wizard.js index 234a8a73a3..6c193befe5 100644 --- a/mailpoet/tests/performance/tests/onboarding-wizard.js +++ b/mailpoet/tests/performance/tests/onboarding-wizard.js @@ -33,7 +33,7 @@ export async function onboardingWizard() { // Go to the MailPoet Welcome Wizard page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-welcome-wizard#/steps/1`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - welcome - wizard# / steps / 1`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/settings-basic.js b/mailpoet/tests/performance/tests/settings-basic.js index fc53df7320..c4cc964972 100644 --- a/mailpoet/tests/performance/tests/settings-basic.js +++ b/mailpoet/tests/performance/tests/settings-basic.js @@ -31,7 +31,7 @@ export async function settingsBasic() { // Go to the Settings page await page.goto( - `${baseURL}/wp-admin/admin.php?page=mailpoet-settings#/basics`, + `${baseURL} / wp - admin / admin.php ? page = mailpoet - settings# / basics`, { waitUntil: 'networkidle', }, diff --git a/mailpoet/tests/performance/tests/subscribers-adding.js b/mailpoet/tests/performance/tests/subscribers-adding.js index 25d0b9f388..dc18fe79fe 100644 --- a/mailpoet/tests/performance/tests/subscribers-adding.js +++ b/mailpoet/tests/performance/tests/subscribers-adding.js @@ -39,9 +39,12 @@ export async function subscribersAdding() { await login(page); // Go to the Subscribers page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - subscribers`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/subscribers-filtering.js b/mailpoet/tests/performance/tests/subscribers-filtering.js index 31546a88b2..19e6a5785e 100644 --- a/mailpoet/tests/performance/tests/subscribers-filtering.js +++ b/mailpoet/tests/performance/tests/subscribers-filtering.js @@ -31,9 +31,12 @@ export async function subscribersFiltering() { await login(page); // Go to the Subscribers page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - subscribers`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/subscribers-listing.js b/mailpoet/tests/performance/tests/subscribers-listing.js index 71f4272329..83244d00ea 100644 --- a/mailpoet/tests/performance/tests/subscribers-listing.js +++ b/mailpoet/tests/performance/tests/subscribers-listing.js @@ -31,9 +31,12 @@ export async function subscribersListing() { await login(page); // Go to the Subscribers page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - subscribers`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js b/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js index 66a9e9b1cc..d836f64c59 100644 --- a/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js +++ b/mailpoet/tests/performance/tests/subscribers-trashing-restoring.js @@ -30,9 +30,12 @@ export async function subscribersTrashingRestoring() { await login(page); // Go to the Subscribers page - await page.goto(`${baseURL}/wp-admin/admin.php?page=mailpoet-subscribers`, { - waitUntil: 'networkidle', - }); + await page.goto( + `${baseURL} / wp - admin / admin.php ? page = mailpoet - subscribers`, + { + waitUntil: 'networkidle', + }, + ); await page.waitForLoadState('networkidle'); await page.screenshot({ diff --git a/mailpoet/tests/performance/utils/helpers.js b/mailpoet/tests/performance/utils/helpers.js index 4bd3dc25fa..85a0bc4756 100644 --- a/mailpoet/tests/performance/utils/helpers.js +++ b/mailpoet/tests/performance/utils/helpers.js @@ -16,7 +16,7 @@ import { export async function login(page) { // Go to WP Admin login page await Promise.all([ - page.goto(`${baseURL}/wp-login.php`, { waitUntil: 'networkidle' }), + page.goto(`${baseURL} / wp - login.php`, { waitUntil: 'networkidle' }), page.waitForSelector('#user_login'), ]); // Enter login credentials and login diff --git a/mailpoet/tests/unit/Automation/Engine/Validation/AutomationGraph/AutomationWalkerTest.php b/mailpoet/tests/unit/Automation/Engine/Validation/AutomationGraph/AutomationWalkerTest.php index 4fab7b90a0..67e40b210c 100644 --- a/mailpoet/tests/unit/Automation/Engine/Validation/AutomationGraph/AutomationWalkerTest.php +++ b/mailpoet/tests/unit/Automation/Engine/Validation/AutomationGraph/AutomationWalkerTest.php @@ -92,7 +92,9 @@ class AutomationWalkerTest extends MailPoetUnitTest { [], array_map(function (string $id) { return new NextStep($id); - }, $nextStepIds)); + }, + $nextStepIds) + ); } private function createAutomation(array $steps): Automation { diff --git a/mailpoet/tests/unit/Entities/FormEntityTest.php b/mailpoet/tests/unit/Entities/FormEntityTest.php index 5934af7fac..03c677a751 100644 --- a/mailpoet/tests/unit/Entities/FormEntityTest.php +++ b/mailpoet/tests/unit/Entities/FormEntityTest.php @@ -52,7 +52,7 @@ class FormEntityTest extends \MailPoetUnitTest { ]; public function testGetBlocksByTypes(): void { - $formEntity = new FormEntity('Test' ); + $formEntity = new FormEntity('Test'); $formEntity->setBody($this->body); $paragraphs = $formEntity->getBlocksByTypes([FormEntity::PARAGRAPH_BLOCK_TYPE]); verify($paragraphs)->arrayCount(3); @@ -70,7 +70,7 @@ class FormEntityTest extends \MailPoetUnitTest { } public function testGetSegmentSelectionSegmentIds() { - $formEntity = new FormEntity('Test' ); + $formEntity = new FormEntity('Test'); $formEntity->setBody($this->body); $segmentIds = $formEntity->getSegmentBlocksSegmentIds(); verify($segmentIds)->empty(); diff --git a/mailpoet/tests/unit/Form/DisplayFormInWPContentTest.php b/mailpoet/tests/unit/Form/DisplayFormInWPContentTest.php index e2d916911e..3539675b53 100644 --- a/mailpoet/tests/unit/Form/DisplayFormInWPContentTest.php +++ b/mailpoet/tests/unit/Form/DisplayFormInWPContentTest.php @@ -51,16 +51,16 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest { $this->wp->expects($this->any())->method('inTheLoop')->willReturn(true); $this->wp->expects($this->any())->method('isMainQuery')->willReturn(true); $this->wp->expects($this->any())->method('wpCreateNonce')->willReturn('asdfgh'); - $this->wp->expects($this->any())->method('applyFilters')->will( $this->returnCallback(function () { return $this->applyFiltersValue; + $this->wp->expects($this->any())->method('applyFilters')->will($this->returnCallback(function () { return $this->applyFiltersValue; - } ) ); + })); WPFunctions::set($this->wp); $this->assetsController = $this->createMock(AssetsController::class); $this->templateRenderer = $this->createMock(TemplateRenderer::class); $this->renderer = $this->createMock(Renderer::class); $this->renderer->expects($this->any())->method('renderStyles')->willReturn(''); $this->renderer->expects($this->any())->method('renderHTML')->willReturn('
'); - $this->subscribersRepository = $this->createMock( SubscribersRepository::class); + $this->subscribersRepository = $this->createMock(SubscribersRepository::class); $this->subscriberSubscribeController = $this->createMock(SubscriberSubscribeController::class); $this->woocommerceHelper = $this->createMock(WCHelper::class); $this->hook = new DisplayFormInWPContent( @@ -277,7 +277,7 @@ class DisplayFormInWPContentTest extends \MailPoetUnitTest { $this->wp->expects($this->never())->method('isSingular'); $this->repository->expects($this->never())->method('findAll'); verify($this->hook->contentDisplay(null))->null(); - verify($this->hook->contentDisplay([1,2,3]))->equals([1,2,3]); + verify($this->hook->contentDisplay([1, 2, 3]))->equals([1, 2, 3]); verify($this->hook->contentDisplay(1))->equals(1); verify($this->hook->contentDisplay(1.1))->equals(1.1); } diff --git a/mailpoet/tests/unit/Subscribers/SubscriberSubscribeControllerUnitTest.php b/mailpoet/tests/unit/Subscribers/SubscriberSubscribeControllerUnitTest.php index 0fec52e13f..e774463339 100644 --- a/mailpoet/tests/unit/Subscribers/SubscriberSubscribeControllerUnitTest.php +++ b/mailpoet/tests/unit/Subscribers/SubscriberSubscribeControllerUnitTest.php @@ -109,11 +109,13 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { 'secondsToTimeString' => '1', ] ); - $fieldNameObfuscator = Stub::makeEmpty(FieldNameObfuscator::class, + $fieldNameObfuscator = Stub::makeEmpty( + FieldNameObfuscator::class, [ 'deobfuscateFormPayload' => function($data) { return $data; }, - ]); + ] + ); $requiredCustomFieldValidator = Stub::makeEmpty(RequiredCustomFieldValidator::class); $settings = Stub::makeEmpty(SettingsController::class); $submitData = []; @@ -188,11 +190,13 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { ); $subscribersFinder = Stub::makeEmpty(SubscribersFinder::class); $throttling = Stub::makeEmpty(SubscriptionThrottling::class); - $fieldNameObfuscator = Stub::makeEmpty(FieldNameObfuscator::class, + $fieldNameObfuscator = Stub::makeEmpty( + FieldNameObfuscator::class, [ 'deobfuscateFormPayload' => function($data) { return $data; }, - ]); + ] + ); $requiredCustomFieldValidator = Stub::makeEmpty(RequiredCustomFieldValidator::class); $settings = Stub::makeEmpty(SettingsController::class); $submitData = []; @@ -260,12 +264,14 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { public function testBuiltInValidatorFails() { $captchaSessionId = 'captcha_session_id'; - $captchaSession = Stub::makeEmpty(CaptchaSession::class, + $captchaSession = Stub::makeEmpty( + CaptchaSession::class, [ 'init' => function($receivedSessionId) use ($captchaSessionId) { verify($receivedSessionId)->equals($captchaSessionId); }, - ]); + ] + ); $subscriberActions = Stub::makeEmpty( SubscriberActions::class, [ @@ -282,23 +288,27 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { 'secondsToTimeString' => '1', ] ); - $fieldNameObfuscator = Stub::makeEmpty(FieldNameObfuscator::class, + $fieldNameObfuscator = Stub::makeEmpty( + FieldNameObfuscator::class, [ 'deobfuscateFormPayload' => function($data) { return $data; }, - ]); + ] + ); $requiredCustomFieldValidator = Stub::makeEmpty(RequiredCustomFieldValidator::class); $captchaSettings = [ 'type' => CaptchaConstants::TYPE_BUILTIN, ]; - $settings = Stub::makeEmpty(SettingsController::class, + $settings = Stub::makeEmpty( + SettingsController::class, [ 'get' => function($value) use ($captchaSettings) { if ($value === 'captcha') { return $captchaSettings; } }, - ]); + ] + ); $submitData = [ 'captcha_session_id' => $captchaSessionId, ]; @@ -380,13 +390,15 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { $captchaSessionId = 'captcha_session_id'; - $captchaSession = Stub::makeEmpty(CaptchaSession::class, + $captchaSession = Stub::makeEmpty( + CaptchaSession::class, [ 'getCaptchaHash' => ['phrase' => 'a_string_that_does_not_match'], 'init' => function($receivedSessionId) use ($captchaSessionId) { verify($receivedSessionId)->equals($captchaSessionId); }, - ]); + ] + ); $subscriberActions = Stub::makeEmpty( SubscriberActions::class, [ @@ -402,24 +414,28 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { 'secondsToTimeString' => '1', ] ); - $fieldNameObfuscator = Stub::makeEmpty(FieldNameObfuscator::class, + $fieldNameObfuscator = Stub::makeEmpty( + FieldNameObfuscator::class, [ 'deobfuscateFormPayload' => function($data) { return $data; }, - ]); + ] + ); $requiredCustomFieldValidator = Stub::makeEmpty(RequiredCustomFieldValidator::class); $captchaSettings = [ 'type' => CaptchaConstants::TYPE_RECAPTCHA, ]; - $settings = Stub::makeEmpty(SettingsController::class, + $settings = Stub::makeEmpty( + SettingsController::class, [ 'get' => function($value) use ($captchaSettings) { if ($value === 'captcha') { return $captchaSettings; } }, - ]); + ] + ); $submitData = [ 'captcha_session_id' => $captchaSessionId, @@ -506,9 +522,9 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { } public function testItShouldReturnTrueIfSubscribedToAnySegmentsInForm() { - $blockSegmentIds = [15,16]; + $blockSegmentIds = [15, 16]; $segmentIds = [17]; - $formSegments = [15,16,17]; + $formSegments = [15, 16, 17]; $subscriberId = 1; $form = Stub::makeEmpty( @@ -616,13 +632,15 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { $captchaSessionId = 'captcha_session_id'; $captcha = 'captcha'; - $captchaSession = Stub::makeEmpty(CaptchaSession::class, + $captchaSession = Stub::makeEmpty( + CaptchaSession::class, [ 'getCaptchaHash' => $captcha, 'init' => function($receivedSessionId) use ($captchaSessionId) { verify($receivedSessionId)->equals($captchaSessionId); }, - ]); + ] + ); $formFields = [ 'field_a' => 'value_a', 'field_b' => 'value_b', @@ -644,7 +662,8 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { return [ 'id' => $id, ]; - }, array_keys($formFields) + }, + array_keys($formFields) )); return $fields; @@ -666,11 +685,13 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { ); $subscribersFinder = Stub::makeEmpty(SubscribersFinder::class); $throttling = Stub::makeEmpty(SubscriptionThrottling::class); - $fieldNameObfuscator = Stub::makeEmpty(FieldNameObfuscator::class, - [ + $fieldNameObfuscator = Stub::makeEmpty( + FieldNameObfuscator::class, + [ 'deobfuscateFormPayload' => function($data) { return $data; }, - ]); + ] + ); $requiredCustomFieldValidator = Stub::makeEmpty(RequiredCustomFieldValidator::class); $settings = Stub::makeEmpty( SettingsController::class, @@ -695,7 +716,7 @@ class SubscriberSubscribeControllerUnitTest extends \MailPoetUnitTest { $statisticsFormsRepository = Stub::makeEmpty(StatisticsFormsRepository::class); $wp = Stub::make( WPFunctions::class, - [ + [ 'doAction' => function($receivedHook, $receivedData, $receivedSegmentIds, $receivedForm) use ($formFields, $segmentIds, $form) { verify($receivedHook)->equals('mailpoet_subscription_before_subscribe'); verify($receivedData)->equals($formFields); diff --git a/mailpoet/tests/unit/Subscription/Captcha/Validator/BuiltInCaptchaValidatorTest.php b/mailpoet/tests/unit/Subscription/Captcha/Validator/BuiltInCaptchaValidatorTest.php index f41d2f1c18..83d88c35a1 100644 --- a/mailpoet/tests/unit/Subscription/Captcha/Validator/BuiltInCaptchaValidatorTest.php +++ b/mailpoet/tests/unit/Subscription/Captcha/Validator/BuiltInCaptchaValidatorTest.php @@ -158,19 +158,19 @@ class BuiltInCaptchaValidatorTest extends \MailPoetUnitTest { $phrase = 'abc'; $subscriptionUrlFactory = Stub::makeEmpty(SubscriptionUrlFactory::class); $captchaPhrase = Stub::make( - CaptchaPhrase::class, - [ + CaptchaPhrase::class, + [ 'getPhrase' => 'something.else.' . $phrase, - ], - $this + ], + $this ); $currentUser = (object)[ 'roles' => ['editor'], ]; $captchaSession = Stub::makeEmpty(CaptchaSession::class); $wp = Stub::make( - WPFunctions::class, - [ + WPFunctions::class, + [ 'isUserLoggedIn' => true, 'applyFilters' => function($filter, $value) { return $value; @@ -178,18 +178,18 @@ class BuiltInCaptchaValidatorTest extends \MailPoetUnitTest { '__' => function($string) { return $string; }, 'wpGetCurrentUser' => $currentUser, - ], - $this + ], + $this ); $subscriberIpRepository = Stub::makeEmpty(SubscriberIPsRepository::class); $subscriberRepository = Stub::makeEmpty(SubscribersRepository::class); $testee = new BuiltInCaptchaValidator( - $subscriptionUrlFactory, - $captchaPhrase, - $captchaSession, - $wp, - $subscriberIpRepository, - $subscriberRepository + $subscriptionUrlFactory, + $captchaPhrase, + $captchaSession, + $wp, + $subscriberIpRepository, + $subscriberRepository ); $data = [ diff --git a/mailpoet/tests/unit/_bootstrap.php b/mailpoet/tests/unit/_bootstrap.php index f2a74cf72b..ead1082c87 100644 --- a/mailpoet/tests/unit/_bootstrap.php +++ b/mailpoet/tests/unit/_bootstrap.php @@ -19,7 +19,7 @@ if (!function_exists('esc_attr')) { // Fix for mocking WPFunctions // [PHPUnit\Framework\Exception] Use of undefined constant OBJECT - assumed 'OBJECT' (this will throw an Error in a future version of PHP) if (!defined('OBJECT')) { - define( 'OBJECT', 'OBJECT' ); + define('OBJECT', 'OBJECT'); } if (!defined('ABSPATH')) {