diff --git a/tasks/code_sniffer/MailPoetTests/ruleset.xml b/tasks/code_sniffer/MailPoetTests/ruleset.xml index a5c738ddf1..41a200942a 100644 --- a/tasks/code_sniffer/MailPoetTests/ruleset.xml +++ b/tasks/code_sniffer/MailPoetTests/ruleset.xml @@ -91,7 +91,7 @@ - + diff --git a/tests/unit/API/JSON/APITest.php b/tests/unit/API/JSON/APITest.php index b0286501a1..82c5e6f794 100644 --- a/tests/unit/API/JSON/APITest.php +++ b/tests/unit/API/JSON/APITest.php @@ -1,4 +1,5 @@ wp_user_id = null; @@ -74,7 +75,7 @@ class JSONAPITest extends MailPoetTest { function testItReturns400ErrorWhenAPIVersionIsNotSpecified() { $data = array( - 'endpoint' => 'namespaced_endpoint_stub', + 'endpoint' => 'a_p_i_test_namespaced_endpoint_stub_v1', 'method' => 'test' ); @@ -90,7 +91,7 @@ class JSONAPITest extends MailPoetTest { $this->api->addEndpointNamespace($namespace['name'], $namespace['version']); $data = array( - 'endpoint' => 'namespaced_endpoint_stub', + 'endpoint' => 'a_p_i_test_namespaced_endpoint_stub_v2', 'api_version' => 'v2', 'method' => 'test' ); @@ -98,7 +99,7 @@ class JSONAPITest extends MailPoetTest { expect($this->api->getRequestedAPIVersion())->equals('v2'); expect($this->api->getRequestedEndpointClass())->equals( - 'MailPoet\API\JSON\v2\NamespacedEndpointStub' + 'MailPoet\API\JSON\v2\APITestNamespacedEndpointStubV2' ); } @@ -110,7 +111,7 @@ class JSONAPITest extends MailPoetTest { $this->api->addEndpointNamespace($namespace['name'], $namespace['version']); $data = array( - 'endpoint' => 'namespaced_endpoint_stub', + 'endpoint' => 'a_p_i_test_namespaced_endpoint_stub_v1', 'method' => 'test', 'api_version' => 'v1', 'data' => array('test' => 'data') @@ -129,7 +130,7 @@ class JSONAPITest extends MailPoetTest { $this->api->addEndpointNamespace($namespace['name'], $namespace['version']); $data = array( - 'endpoint' => 'namespaced_endpoint_stub', + 'endpoint' => 'a_p_i_test_namespaced_endpoint_stub_v2', 'api_version' => 'v2', 'method' => 'testVersion' ); diff --git a/tests/unit/API/JSON/APITestNamespacedEndpointStubV1.php b/tests/unit/API/JSON/APITestNamespacedEndpointStubV1.php index e261461208..4f6d79abb5 100644 --- a/tests/unit/API/JSON/APITestNamespacedEndpointStubV1.php +++ b/tests/unit/API/JSON/APITestNamespacedEndpointStubV1.php @@ -7,7 +7,7 @@ use MailPoet\API\JSON\Access as APIAccess; if(!defined('ABSPATH')) exit; -class NamespacedEndpointStub extends APIEndpoint { +class APITestNamespacedEndpointStubV1 extends APIEndpoint { public $permissions = array( 'test' => APIAccess::ALL ); diff --git a/tests/unit/API/JSON/APITestNamespacedEndpointStubV2.php b/tests/unit/API/JSON/APITestNamespacedEndpointStubV2.php index 27a68cea2d..b0029f2d81 100644 --- a/tests/unit/API/JSON/APITestNamespacedEndpointStubV2.php +++ b/tests/unit/API/JSON/APITestNamespacedEndpointStubV2.php @@ -7,7 +7,7 @@ use MailPoet\API\JSON\Endpoint as APIEndpoint; if(!defined('ABSPATH')) exit; -class NamespacedEndpointStub extends APIEndpoint { +class APITestNamespacedEndpointStubV2 extends APIEndpoint { public $permissions = array( 'testVersion' => APIAccess::ALL ); diff --git a/tests/unit/API/JSON/v1/MailerTest.php b/tests/unit/API/JSON/v1/MailerTest.php index 251aa1b3d3..42b171c6d5 100644 --- a/tests/unit/API/JSON/v1/MailerTest.php +++ b/tests/unit/API/JSON/v1/MailerTest.php @@ -1,10 +1,11 @@ MailerLog::STATUS_PAUSED); diff --git a/tests/unit/API/MP/APITest.php b/tests/unit/API/MP/APITest.php index d90babf910..a04f96c4ad 100644 --- a/tests/unit/API/MP/APITest.php +++ b/tests/unit/API/MP/APITest.php @@ -1,4 +1,5 @@ Stub::once() @@ -261,7 +262,7 @@ class MPAPITest extends MailPoetTest { function testItDoesNotScheduleWelcomeNotificationAfterAddingSubscriberIfStatusIsNotSubscribed() { $API = Stub::makeEmptyExcept( - new MailPoet\API\MP\v1\API(), + new \MailPoet\API\MP\v1\API(), 'addSubscriber', array( '_scheduleWelcomeNotification' => Stub::never() @@ -275,7 +276,7 @@ class MPAPITest extends MailPoetTest { function testItDoesNotScheduleWelcomeNotificationAfterAddingSubscriberWhenDisabledByOption() { $API = Stub::makeEmptyExcept( - new MailPoet\API\MP\v1\API(), + new \MailPoet\API\MP\v1\API(), 'addSubscriber', array( '_scheduleWelcomeNotification' => Stub::never() @@ -291,7 +292,7 @@ class MPAPITest extends MailPoetTest { function testByDefaultItSendsConfirmationEmailAfterAddingSubscriber() { $API = Stub::makeEmptyExcept( - new MailPoet\API\MP\v1\API(), + new \MailPoet\API\MP\v1\API(), 'addSubscriber', array( '_sendConfirmationEmail' => Stub::once() @@ -305,7 +306,7 @@ class MPAPITest extends MailPoetTest { function testItDoesNotSendConfirmationEmailAfterAddingSubscriberWhenOptionIsSet() { $API = Stub::makeEmptyExcept( - new MailPoet\API\MP\v1\API(), + new \MailPoet\API\MP\v1\API(), 'addSubscriber', array( '_sendConfirmationEmail' => Stub::never() @@ -319,9 +320,9 @@ class MPAPITest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); - ORM::raw_execute('TRUNCATE ' . CustomField::$_table); - ORM::raw_execute('TRUNCATE ' . Segment::$_table); - ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); + \ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); + \ORM::raw_execute('TRUNCATE ' . CustomField::$_table); + \ORM::raw_execute('TRUNCATE ' . Segment::$_table); + \ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); } } \ No newline at end of file diff --git a/tests/unit/Config/DatabaseTest.php b/tests/unit/Config/DatabaseTest.php index 1f028f32fb..880df421d1 100644 --- a/tests/unit/Config/DatabaseTest.php +++ b/tests/unit/Config/DatabaseTest.php @@ -1,10 +1,11 @@ database; $database->setupDriverOptions(); - $current_setting = ORM::for_table("") + $current_setting = \ORM::for_table("") ->raw_query('SELECT @@session.wait_timeout as wait_timeout') ->findOne(); expect($current_setting->wait_timeout)->greaterThan($database->driver_option_wait_timeout); $this->_before(); $database->driver_option_wait_timeout = 99999; $database->setupDriverOptions(); - $current_setting = ORM::for_table("") + $current_setting = \ORM::for_table("") ->raw_query('SELECT @@session.wait_timeout as wait_timeout') ->findOne(); expect($current_setting->wait_timeout)->equals(99999); @@ -47,7 +48,7 @@ class DatabaseTestTest extends MailPoetTest { function testItSetsDBDriverOptions() { $this->database->init(); - $result = ORM::for_table("") + $result = \ORM::for_table("") ->raw_query( 'SELECT ' . '@@sql_mode as sql_mode, ' . diff --git a/tests/unit/Config/ShortcodesTest.php b/tests/unit/Config/ShortcodesTest.php index ceaa01226b..63707835fb 100644 --- a/tests/unit/Config/ShortcodesTest.php +++ b/tests/unit/Config/ShortcodesTest.php @@ -1,4 +1,5 @@ type = Newsletter::TYPE_STANDARD; @@ -22,7 +23,7 @@ class ConfigShortcodesTest extends MailPoetTest { $shortcodes = new Shortcodes(); // result contains a link pointing to the "view in browser" router endpoint $result = $shortcodes->getArchive($params = false); - $dom = pQuery::parseStr($result); + $dom = \pQuery::parseStr($result); $link = $dom->query('a'); $link = $link->attr('href'); expect($link)->contains('endpoint=view_in_browser'); diff --git a/tests/unit/Cron/CronTriggerMockMethod.php b/tests/unit/Cron/CronTriggerMockMethod.php index 26bd8b1f8a..3da814311f 100644 --- a/tests/unit/Cron/CronTriggerMockMethod.php +++ b/tests/unit/Cron/CronTriggerMockMethod.php @@ -2,7 +2,7 @@ namespace MailPoet\Cron\Triggers; -class MockMethod { +class CronTriggerMockMethod { static function run() { return true; } diff --git a/tests/unit/Cron/CronTriggerMockMethodWithException.php b/tests/unit/Cron/CronTriggerMockMethodWithException.php index b6838719a7..2848484e54 100644 --- a/tests/unit/Cron/CronTriggerMockMethodWithException.php +++ b/tests/unit/Cron/CronTriggerMockMethodWithException.php @@ -2,7 +2,7 @@ namespace MailPoet\Cron\Triggers; -class MockMethodWithException { +class CronTriggerMockMethodWithException { static function run() { throw new \Exception('Exception thrown'); } diff --git a/tests/unit/Cron/CronTriggerTest.php b/tests/unit/Cron/CronTriggerTest.php index 2aa1428a0a..3e0a0cedb2 100644 --- a/tests/unit/Cron/CronTriggerTest.php +++ b/tests/unit/Cron/CronTriggerTest.php @@ -28,8 +28,8 @@ class CronTriggerTest extends MailPoetTest { } function testItCanGetCurrentMethod() { - Setting::setValue(CronTrigger::SETTING_NAME, array('method' => 'MockMethod')); - expect($this->cron_trigger->getCurrentMethod())->equals('MockMethod'); + Setting::setValue(CronTrigger::SETTING_NAME, array('method' => 'CronTriggerMockMethod')); + expect($this->cron_trigger->getCurrentMethod())->equals('CronTriggerMockMethod'); } function testItCanReturnAvailableMethods() { @@ -39,7 +39,7 @@ class CronTriggerTest extends MailPoetTest { function testItCanInitializeCronTriggerMethod() { $cron_trigger = $this->cron_trigger; - $cron_trigger->current_method = 'MockMethod'; + $cron_trigger->current_method = 'CronTriggerMockMethod'; expect($cron_trigger->init())->true(); } @@ -51,11 +51,11 @@ class CronTriggerTest extends MailPoetTest { function testItIgnoresExceptionsThrownFromCronTriggerMethods() { $cron_trigger = $this->cron_trigger; - $cron_trigger->current_method = 'MockMethodWithException'; + $cron_trigger->current_method = 'CronTriggerMockMethodWithException'; expect($cron_trigger->init())->null(); } function _after() { - ORM::raw_execute('TRUNCATE ' . Setting::$_table); + \ORM::raw_execute('TRUNCATE ' . Setting::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Triggers/MailPoetTest.php b/tests/unit/Cron/Triggers/MailPoetTest.php index c4b2b61584..c5c7bf6663 100644 --- a/tests/unit/Cron/Triggers/MailPoetTest.php +++ b/tests/unit/Cron/Triggers/MailPoetTest.php @@ -1,11 +1,12 @@ worker = new Bounce(microtime(true)); - $this->worker->api = new MailPoet\Cron\Workers\Bounce\MockAPI('key'); + $this->worker->api = new MockAPI('key'); } function testItDefinesConstants() { @@ -124,9 +125,9 @@ class BounceTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Setting::$_table); - ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); - ORM::raw_execute('TRUNCATE ' . ScheduledTaskSubscriber::$_table); - ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); + \ORM::raw_execute('TRUNCATE ' . Setting::$_table); + \ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); + \ORM::raw_execute('TRUNCATE ' . ScheduledTaskSubscriber::$_table); + \ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/BounceTestMockAPI.php b/tests/unit/Cron/Workers/BounceTestMockAPI.php index 794ac7d957..b0899d71d1 100644 --- a/tests/unit/Cron/Workers/BounceTestMockAPI.php +++ b/tests/unit/Cron/Workers/BounceTestMockAPI.php @@ -3,7 +3,7 @@ namespace MailPoet\Cron\Workers\Bounce; if(!defined('ABSPATH')) exit; -class MockAPI { +class BounceTestMockAPI { function checkBounces(array $emails) { return array_map( function ($email) { diff --git a/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerMockImplementation.php b/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerMockImplementation.php index b9dfd75a41..ce7e634133 100644 --- a/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerMockImplementation.php +++ b/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerMockImplementation.php @@ -3,7 +3,7 @@ namespace MailPoet\Cron\Workers\KeyCheck; if(!defined('ABSPATH')) exit; -class MockKeyCheckWorker extends KeyCheckWorker { +class KeyCheckWorkerMockImplementation extends KeyCheckWorker { const TASK_TYPE = 'mock_key_check_worker'; function checkKey() { diff --git a/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerTest.php b/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerTest.php index c8f2dbb9f5..d0f3ca3b55 100644 --- a/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerTest.php +++ b/tests/unit/Cron/Workers/KeyCheck/KeyCheckWorkerTest.php @@ -7,7 +7,7 @@ use MailPoet\Models\Setting; use MailPoet\Services\Bridge; require_once('KeyCheckWorkerMockImplementation.php'); -use MailPoet\Cron\Workers\KeyCheck\MockKeyCheckWorker; +use MailPoet\Cron\Workers\KeyCheck\KeyCheckWorkerMockImplementation as MockKeyCheckWorker; class KeyCheckWorkerTest extends MailPoetTest { function _before() { @@ -65,7 +65,7 @@ class KeyCheckWorkerTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Setting::$_table); - ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); + \ORM::raw_execute('TRUNCATE ' . Setting::$_table); + \ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/SendingQueue/Tasks/LinksTest.php b/tests/unit/Cron/Workers/SendingQueue/Tasks/LinksTest.php index 0b915e6b13..53b67dce1a 100644 --- a/tests/unit/Cron/Workers/SendingQueue/Tasks/LinksTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/Tasks/LinksTest.php @@ -1,11 +1,13 @@ mailer_task->mailer instanceof MailPoet\Mailer\Mailer)->true(); + expect($this->mailer_task->mailer instanceof \MailPoet\Mailer\Mailer)->true(); } function testItCanConfigureMailerWithSenderAndReplyToAddresses() { - $newsletter = new stdClass(); + $newsletter = new \stdClass(); // when no sender/reply-to information is set, use the sender information // from Settings @@ -122,7 +124,7 @@ class MailerTaskTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Setting::$_table); - ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); + \ORM::raw_execute('TRUNCATE ' . Setting::$_table); + \ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php b/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php index fcc798ec65..53d3c31ab5 100644 --- a/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/Tasks/NewsletterTest.php @@ -1,4 +1,5 @@ newsletter_task = new NewsletterTask(); $this->subscriber = Subscriber::create(); @@ -188,7 +189,7 @@ class NewsletterTaskTest extends MailPoetTest { function testItUpdatesStatusAndSetsSentAtDateOnlyForStandardAndPostNotificationNewsletters() { $newsletter = $this->newsletter; - $queue = new stdClass(); + $queue = new \stdClass(); $queue->processed_at = date('Y-m-d H:i:s'); // newsletter type is 'standard' @@ -265,7 +266,7 @@ class NewsletterTaskTest extends MailPoetTest { try { $this->newsletter_task->preProcessNewsletter($this->newsletter, $queue); self::fail('Sending error exception was not thrown.'); - } catch(Exception $e) { + } catch(\Exception $e) { $mailer_log = MailerLog::getMailerLog(); expect($mailer_log['error']['operation'])->equals('queue_save'); expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.'); @@ -274,7 +275,7 @@ class NewsletterTaskTest extends MailPoetTest { function testItLogsErrorWhenExistingRenderedNewsletterBodyIsInvalid() { $queue_mock = Mock::double( - new stdClass(), + new \stdClass(), array( 'getNewsletterRenderedBody' => 'a:2:{s:4:"html"' ) @@ -282,7 +283,7 @@ class NewsletterTaskTest extends MailPoetTest { try { $this->newsletter_task->preProcessNewsletter($this->newsletter, $queue_mock); self::fail('Sending error exception was not thrown.'); - } catch(Exception $e) { + } catch(\Exception $e) { $mailer_log = MailerLog::getMailerLog(); expect($mailer_log['error']['operation'])->equals('queue_save'); expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.'); @@ -292,7 +293,7 @@ class NewsletterTaskTest extends MailPoetTest { function testItLogsErrorWhenNewlyRenderedNewsletterBodyIsInvalid() { $queue = $this->queue; $queue_mock = Mock::double( - new stdClass(), + new \stdClass(), array( 'getNewsletterRenderedBody' => null ) @@ -305,7 +306,7 @@ class NewsletterTaskTest extends MailPoetTest { try { $this->newsletter_task->preProcessNewsletter($this->newsletter, $queue_mock); self::fail('Sending error exception was not thrown.'); - } catch(Exception $e) { + } catch(\Exception $e) { $mailer_log = MailerLog::getMailerLog(); expect($mailer_log['error']['operation'])->equals('queue_save'); expect($mailer_log['error']['error_message'])->equals('There was an error processing your newsletter during sending. If possible, please contact us and report this issue.'); @@ -315,7 +316,7 @@ class NewsletterTaskTest extends MailPoetTest { function testItPreProcessesNewsletterWhenNewlyRenderedNewsletterBodyIsValid() { $queue = $this->queue; $queue_mock = Mock::double( - new stdClass(), + new \stdClass(), array( 'getNewsletterRenderedBody' => null ) @@ -330,10 +331,10 @@ class NewsletterTaskTest extends MailPoetTest { function _after() { WPHooksHelper::releaseAllHooks(); - ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); - ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); - ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); - ORM::raw_execute('TRUNCATE ' . NewsletterLink::$_table); - ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); + \ORM::raw_execute('TRUNCATE ' . Subscriber::$_table); + \ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); + \ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterLink::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/SendingQueue/Tasks/PostsTest.php b/tests/unit/Cron/Workers/SendingQueue/Tasks/PostsTest.php index f478f00fb9..b787116f44 100644 --- a/tests/unit/Cron/Workers/SendingQueue/Tasks/PostsTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/Tasks/PostsTest.php @@ -1,4 +1,5 @@ 1, @@ -49,6 +50,6 @@ class PostsTaskTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/SendingQueue/Tasks/ShortcodesTest.php b/tests/unit/Cron/Workers/SendingQueue/Tasks/ShortcodesTest.php index ac09b59577..0e2a3686a4 100644 --- a/tests/unit/Cron/Workers/SendingQueue/Tasks/ShortcodesTest.php +++ b/tests/unit/Cron/Workers/SendingQueue/Tasks/ShortcodesTest.php @@ -1,11 +1,13 @@ 1 @@ -21,7 +23,7 @@ class ShortcodesTaskTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); - ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); + \ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); + \ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); } } \ No newline at end of file diff --git a/tests/unit/Cron/Workers/SimpleWorkerMockImplementation.php b/tests/unit/Cron/Workers/SimpleWorkerMockImplementation.php index df8f7ca84a..c4e659a5c5 100644 --- a/tests/unit/Cron/Workers/SimpleWorkerMockImplementation.php +++ b/tests/unit/Cron/Workers/SimpleWorkerMockImplementation.php @@ -3,7 +3,7 @@ namespace MailPoet\Cron\Workers; if(!defined('ABSPATH')) exit; -class MockSimpleWorker extends SimpleWorker { +class SimpleWorkerMockImplementation extends SimpleWorker { const TASK_TYPE = 'mock_simple_worker'; function init() { diff --git a/tests/unit/Cron/Workers/SimpleWorkerTest.php b/tests/unit/Cron/Workers/SimpleWorkerTest.php index e068f68f7b..0b29f4b583 100644 --- a/tests/unit/Cron/Workers/SimpleWorkerTest.php +++ b/tests/unit/Cron/Workers/SimpleWorkerTest.php @@ -8,7 +8,7 @@ use MailPoet\Models\ScheduledTask; use MailPoet\Models\Setting; require_once('SimpleWorkerMockImplementation.php'); -use MailPoet\Cron\Workers\MockSimpleWorker; +use MailPoet\Cron\Workers\SimpleWorkerMockImplementation as MockSimpleWorker; class SimpleWorkerTest extends MailPoetTest { function _before() { @@ -193,7 +193,7 @@ class SimpleWorkerTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Setting::$_table); - ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); + \ORM::raw_execute('TRUNCATE ' . Setting::$_table); + \ORM::raw_execute('TRUNCATE ' . ScheduledTask::$_table); } } \ No newline at end of file diff --git a/tests/unit/Newsletter/RendererTest.php b/tests/unit/Newsletter/RendererTest.php index 05c2c116a8..34c651dec8 100644 --- a/tests/unit/Newsletter/RendererTest.php +++ b/tests/unit/Newsletter/RendererTest.php @@ -1,4 +1,5 @@ newsletter = array( diff --git a/tests/unit/Newsletter/Scheduler/SchedulerTest.php b/tests/unit/Newsletter/Scheduler/SchedulerTest.php index 7f347e5ff9..79f4c8d3d1 100644 --- a/tests/unit/Newsletter/Scheduler/SchedulerTest.php +++ b/tests/unit/Newsletter/Scheduler/SchedulerTest.php @@ -1,4 +1,5 @@ notEmpty(); expect(Scheduler::LAST_WEEKDAY_FORMAT)->notEmpty(); @@ -468,10 +469,10 @@ class NewsletterSchedulerTest extends MailPoetTest { } function _after() { - ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); - ORM::raw_execute('TRUNCATE ' . NewsletterOption::$_table); - ORM::raw_execute('TRUNCATE ' . NewsletterOptionField::$_table); - ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); - ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); + \ORM::raw_execute('TRUNCATE ' . Newsletter::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterOption::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterOptionField::$_table); + \ORM::raw_execute('TRUNCATE ' . NewsletterPost::$_table); + \ORM::raw_execute('TRUNCATE ' . SendingQueue::$_table); } } \ No newline at end of file diff --git a/tests/unit/Router/Endpoints/ViewInBrowserTest.php b/tests/unit/Router/Endpoints/ViewInBrowserTest.php index 5753258e40..5727a9c863 100644 --- a/tests/unit/Router/Endpoints/ViewInBrowserTest.php +++ b/tests/unit/Router/Endpoints/ViewInBrowserTest.php @@ -1,4 +1,5 @@ add_role('administrator'); diff --git a/tests/unit/Router/RouterTest.php b/tests/unit/Router/RouterTest.php index 737bc85383..58d31d7603 100644 --- a/tests/unit/Router/RouterTest.php +++ b/tests/unit/Router/RouterTest.php @@ -1,11 +1,12 @@ router_data = array( Router::NAME => '', - 'endpoint' => 'mock_endpoint', + 'endpoint' => 'router_test_mock_endpoint', 'action' => 'test', 'data' => base64_encode(json_encode(array('data' => 'dummy data'))) ); @@ -133,10 +134,10 @@ class FrontRouterTest extends MailPoetTest { $data = array('data' => 'dummy data'); $encoded_data = rtrim(base64_encode(json_encode($data)), '='); $result = Router::buildRequest( - 'mock_endpoint', + 'router_test_mock_endpoint', 'test', $data ); - expect($result)->contains(Router::NAME . '&endpoint=mock_endpoint&action=test&data=' . $encoded_data); + expect($result)->contains(Router::NAME . '&endpoint=router_test_mock_endpoint&action=test&data=' . $encoded_data); } } diff --git a/tests/unit/Router/RouterTestMockEndpoint.php b/tests/unit/Router/RouterTestMockEndpoint.php index ee0157b21b..24ab75f774 100644 --- a/tests/unit/Router/RouterTestMockEndpoint.php +++ b/tests/unit/Router/RouterTestMockEndpoint.php @@ -2,7 +2,7 @@ namespace MailPoet\Router\Endpoints; -class MockEndpoint { +class RouterTestMockEndpoint { const ACTION_TEST = 'test'; public $allowed_actions = array( self::ACTION_TEST diff --git a/tests/unit/Services/BridgeTest.php b/tests/unit/Services/BridgeTest.php index 3fde8a2747..882830cb25 100644 --- a/tests/unit/Services/BridgeTest.php +++ b/tests/unit/Services/BridgeTest.php @@ -7,6 +7,7 @@ use MailPoet\Mailer\Mailer; use MailPoet\Models\Setting; require_once('BridgeTestMockAPI.php'); +use MailPoet\Services\Bridge\BridgeTestMockAPI as MockAPI; class BridgeTest extends MailPoetTest { function _before() { @@ -20,7 +21,7 @@ class BridgeTest extends MailPoetTest { $this->bridge = new Bridge(); - $this->bridge->api = new MailPoet\Services\Bridge\MockAPI('key'); + $this->bridge->api = new MockAPI('key'); } function testItChecksIfCurrentSendingMethodIsMailpoet() { diff --git a/tests/unit/Services/BridgeTestMockAPI.php b/tests/unit/Services/BridgeTestMockAPI.php index e816dfe70e..ac0f1eafdf 100644 --- a/tests/unit/Services/BridgeTestMockAPI.php +++ b/tests/unit/Services/BridgeTestMockAPI.php @@ -5,7 +5,7 @@ use Carbon\Carbon; if(!defined('ABSPATH')) exit; -class MockAPI { +class BridgeTestMockAPI { public $api_key; function __construct($api_key) { diff --git a/tests/unit/Subscription/FormTest.php b/tests/unit/Subscription/FormTest.php index 6a6881a3e8..b115de96be 100644 --- a/tests/unit/Subscription/FormTest.php +++ b/tests/unit/Subscription/FormTest.php @@ -1,4 +1,5 @@ segment = SegmentModel::createOrUpdate( array( @@ -101,9 +102,9 @@ class SubscriptionFormSubmissionTest extends MailPoetTest { function _after() { Mock::clean(); wp_delete_post($this->post); - ORM::raw_execute('TRUNCATE ' . SegmentModel::$_table); - ORM::raw_execute('TRUNCATE ' . FormModel::$_table); - ORM::raw_execute('TRUNCATE ' . SubscriberModel::$_table); - ORM::raw_execute('TRUNCATE ' . SettingModel::$_table); + \ORM::raw_execute('TRUNCATE ' . SegmentModel::$_table); + \ORM::raw_execute('TRUNCATE ' . FormModel::$_table); + \ORM::raw_execute('TRUNCATE ' . SubscriberModel::$_table); + \ORM::raw_execute('TRUNCATE ' . SettingModel::$_table); } } \ No newline at end of file diff --git a/tests/unit/Util/License/Features/SubscribersTest.php b/tests/unit/Util/License/Features/SubscribersTest.php index be00717663..8155ab856e 100644 --- a/tests/unit/Util/License/Features/SubscribersTest.php +++ b/tests/unit/Util/License/Features/SubscribersTest.php @@ -1,11 +1,12 @@ startsWith('http'); diff --git a/tests/unit/WP/HooksTest.php b/tests/unit/WP/HooksTest.php index ff4caad0d7..ef63662647 100644 --- a/tests/unit/WP/HooksTest.php +++ b/tests/unit/WP/HooksTest.php @@ -1,8 +1,9 @@ action = 'mailpoet_test_action'; $this->filter = 'mailpoet_test_filter'; @@ -10,7 +11,7 @@ class WPHooksTest extends MailPoetTest { function testItCanProcessActions() { $test_value = array('abc', 'def'); - $test_value2 = new StdClass; + $test_value2 = new \stdClass; $called = false; $callback = function ($value, $value2) use ($test_value, $test_value2, &$called) { diff --git a/tests/unit/WP/PostsTest.php b/tests/unit/WP/PostsTest.php index bce510493b..20e7fee11b 100644 --- a/tests/unit/WP/PostsTest.php +++ b/tests/unit/WP/PostsTest.php @@ -1,9 +1,10 @@