diff --git a/lib/Services/Bridge.php b/lib/Services/Bridge.php index bcb8e4ef96..09a3b0e2e3 100644 --- a/lib/Services/Bridge.php +++ b/lib/Services/Bridge.php @@ -87,7 +87,7 @@ class Bridge { * @param string $key * @return API */ - private function getApi($key) { + public function getApi($key) { $this->initApi($key); assert($this->api instanceof API); return $this->api; diff --git a/tests/integration/Cron/DaemonHttpRunnerTest.php b/tests/integration/Cron/DaemonHttpRunnerTest.php index dd0b1262a9..99e305d68c 100644 --- a/tests/integration/Cron/DaemonHttpRunnerTest.php +++ b/tests/integration/Cron/DaemonHttpRunnerTest.php @@ -249,8 +249,8 @@ class DaemonHttpRunnerTest extends \MailPoetTest { } public function testItCanRun() { - ignore_user_abort(0); - expect(ignore_user_abort())->equals(0); + ignore_user_abort(false); + expect(ignore_user_abort())->equals(false); $daemon_http_runner = $this->make(DaemonHttpRunner::class, [ 'pauseExecution' => null, // daemon should call itself @@ -268,7 +268,7 @@ class DaemonHttpRunnerTest extends \MailPoetTest { $daemon = new Daemon($this->cron_helper, $cron_worker_runner_mock, $this->createWorkersFactoryMock()); $daemon_http_runner->__construct($daemon, $this->cron_helper, SettingsController::getInstance(), $this->di_container->get(WordPress::class)); $daemon_http_runner->run($data); - expect(ignore_user_abort())->equals(1); + expect(ignore_user_abort())->equals(true); } public function testItRespondsToPingRequest() { diff --git a/tests/integration/Cron/Workers/SimpleWorkerTest.php b/tests/integration/Cron/Workers/SimpleWorkerTest.php index 0adf23ca2b..3428b83b44 100644 --- a/tests/integration/Cron/Workers/SimpleWorkerTest.php +++ b/tests/integration/Cron/Workers/SimpleWorkerTest.php @@ -29,8 +29,8 @@ class SimpleWorkerTest extends \MailPoetTest { [], $this ); + $worker_class = get_class($worker); try { - $worker_class = get_class($worker); new $worker_class(); $this->fail('SimpleWorker did not throw an exception'); } catch (\Exception $e) { diff --git a/tests/integration/Doctrine/Types/JsonTypesTest.php b/tests/integration/Doctrine/Types/JsonTypesTest.php index 93cd564bfc..c46e33b66f 100644 --- a/tests/integration/Doctrine/Types/JsonTypesTest.php +++ b/tests/integration/Doctrine/Types/JsonTypesTest.php @@ -132,7 +132,7 @@ class JsonTypesTest extends \MailPoetTest { public function testItDoesNotSaveInvalidData() { $entity = new JsonEntity(); - $entity->setJsonData("\xB1\x31"); // invalid unicode sequence + $entity->setJsonData(["\xB1\x31"]); // invalid unicode sequence $this->entity_manager->persist($entity); $exception = null; diff --git a/tests/integration/DynamicSegments/FreePluginConnectors/SendingNewslettersSubscribersFinderTest.php b/tests/integration/DynamicSegments/FreePluginConnectors/SendingNewslettersSubscribersFinderTest.php index 8c3202dfb5..886bfa63d3 100644 --- a/tests/integration/DynamicSegments/FreePluginConnectors/SendingNewslettersSubscribersFinderTest.php +++ b/tests/integration/DynamicSegments/FreePluginConnectors/SendingNewslettersSubscribersFinderTest.php @@ -36,7 +36,7 @@ class SendingNewslettersSubscribersFinderTest extends \MailPoetTest { ->method('load'); $segment = Segment::create(); $segment->type = Segment::TYPE_DEFAULT; - $segment->id = 3; + $segment->id = '3'; $result = $this->subscribers_in_segments_finder->findSubscribersInSegment($segment, []); expect($result)->count(0); } diff --git a/tests/integration/Mailer/MailerLogTest.php b/tests/integration/Mailer/MailerLogTest.php index cea32b973c..44e1f689b6 100644 --- a/tests/integration/Mailer/MailerLogTest.php +++ b/tests/integration/Mailer/MailerLogTest.php @@ -194,6 +194,7 @@ class MailerLogTest extends \MailPoetTest { public function testItPausesSendingAfterProcessingSendingError() { $mailer_log = MailerLog::getMailerLog(); expect($mailer_log['error'])->null(); + $error = null; try { MailerLog::processError($operation = 'send', $error = 'email rejected - sending paused', $error_code = null, $pause_sending = true); $this->fail('Paused sending exception was not thrown.'); diff --git a/tests/integration/Models/SubscriberTest.php b/tests/integration/Models/SubscriberTest.php index d8767b346a..8c83722e03 100644 --- a/tests/integration/Models/SubscriberTest.php +++ b/tests/integration/Models/SubscriberTest.php @@ -752,6 +752,9 @@ class SubscriberTest extends \MailPoetTest { // create 3 subscribers, segments and subscriber-segment relations $prepare_data = function() { $this->_after(); + $subscriber = []; + $segment = []; + $subscriber_segment = []; for ($i = 1; $i <= 3; $i++) { $subscriber[$i] = Subscriber::create(); $subscriber[$i]->status = Subscriber::STATUS_SUBSCRIBED; diff --git a/tests/integration/Newsletter/Links/LinksTest.php b/tests/integration/Newsletter/Links/LinksTest.php index 734da1f6ae..7d167d39d1 100644 --- a/tests/integration/Newsletter/Links/LinksTest.php +++ b/tests/integration/Newsletter/Links/LinksTest.php @@ -39,7 +39,7 @@ class LinksTest extends \MailPoetTest { $link = NewsletterLink::create(); $link->newsletter_id = 3; $link->queue_id = 3; - $link->hash = 123; + $link->hash = '123'; $link->url = 'http://example.com'; $link->save(); @@ -174,7 +174,7 @@ class LinksTest extends \MailPoetTest { $links = [ [ 'link' => 'http://example.com', - 'hash' => 123, + 'hash' => '123', ], ]; Links::save( @@ -187,7 +187,7 @@ class LinksTest extends \MailPoetTest { $newsltter_link = NewsletterLink::where('newsletter_id', 1) ->where('queue_id', 1) ->findOne(); - expect($newsltter_link->hash)->equals(123); + expect($newsltter_link->hash)->equals('123'); expect($newsltter_link->url)->equals('http://example.com'); } @@ -195,21 +195,21 @@ class LinksTest extends \MailPoetTest { $link = NewsletterLink::create(); $link->newsletter_id = 1; $link->queue_id = 2; - $link->hash = 123; + $link->hash = '123'; $link->url = 'http://example.com'; $link->save(); $link = NewsletterLink::create(); $link->newsletter_id = 1; $link->queue_id = 3; - $link->hash = 456; + $link->hash = '456'; $link->url = 'http://demo.com'; $link->save(); list($content, $links) = Links::process('x', 1, 2); expect(is_array($links))->true(); expect(count($links))->equals(1); - expect($links[0]['hash'])->equals(123); + expect($links[0]['hash'])->equals('123'); expect($links[0]['url'])->equals('http://example.com'); } diff --git a/tests/integration/Newsletter/RendererTest.php b/tests/integration/Newsletter/RendererTest.php index 90ab082013..88bb70c5f5 100644 --- a/tests/integration/Newsletter/RendererTest.php +++ b/tests/integration/Newsletter/RendererTest.php @@ -75,6 +75,7 @@ class RendererTest extends \MailPoetTest { $column_content ) ); + $rendered_column_content = []; foreach ($DOM('table.mailpoet_cols-one > tbody') as $column) { $rendered_column_content[] = trim($column->text()); }; @@ -101,6 +102,7 @@ class RendererTest extends \MailPoetTest { $column_content ) ); + $rendered_column_content = []; foreach ($DOM('table.mailpoet_cols-two > tbody') as $column) { $rendered_column_content[] = trim($column->text()); }; @@ -128,6 +130,7 @@ class RendererTest extends \MailPoetTest { $column_content ) ); + $rendered_column_content = []; foreach ($DOM('table.mailpoet_cols-three > tbody') as $column) { $rendered_column_content[] = trim($column->text()); }; diff --git a/tests/integration/Services/BridgeTest.php b/tests/integration/Services/BridgeTest.php index b82bddb727..ee8aa65a7d 100644 --- a/tests/integration/Services/BridgeTest.php +++ b/tests/integration/Services/BridgeTest.php @@ -67,8 +67,7 @@ class BridgeTest extends \MailPoetTest { public function testItInstantiatesDefaultAPI() { $this->bridge->api = null; - $this->bridge->initApi(null); - expect($this->bridge->api instanceof API)->true(); + expect($this->bridge->getApi('key') instanceof API)->true(); } public function testItChecksValidMSSKey() { diff --git a/tests/integration/Statistics/Track/ClicksTest.php b/tests/integration/Statistics/Track/ClicksTest.php index b7ce504f86..b2768b406a 100644 --- a/tests/integration/Statistics/Track/ClicksTest.php +++ b/tests/integration/Statistics/Track/ClicksTest.php @@ -80,7 +80,7 @@ class ClicksTest extends \MailPoetTest { ], $this); $data = $this->track_data; // 1. when tracking data does not exist - $clicks->track(false); + $clicks->track(null); // 2. when link model object is missing unset($data->link); $clicks->track($data); diff --git a/tests/integration/Util/ConflictResolverTest.php b/tests/integration/Util/ConflictResolverTest.php index e180e24f21..cc6e7c2432 100644 --- a/tests/integration/Util/ConflictResolverTest.php +++ b/tests/integration/Util/ConflictResolverTest.php @@ -71,7 +71,7 @@ class ConflictResolverTest extends \MailPoetTest { $permitted_asset_location = $this->conflict_resolver->permitted_assets_locations['scripts'][array_rand($this->conflict_resolver->permitted_assets_locations['scripts'], 1)]; // enqueue scripts wp_enqueue_script('select2', '/wp-content/some/offending/plugin/select2.js'); - wp_enqueue_script('some_random_script', 'http://example.com/some_script.js', null, null, $in_footer = true); // test inside footer + wp_enqueue_script('some_random_script', 'http://example.com/some_script.js', [], null, $in_footer = true); // test inside footer wp_enqueue_script('permitted_script', trim($permitted_asset_location, '^')); $this->conflict_resolver->resolveScriptsConflict(); do_action('wp_print_scripts');