Fix PEAR.WhiteSpace.ScopeClosingBrace rule in tests [MAILPOET-989]
This commit is contained in:
@@ -76,11 +76,11 @@
|
||||
</rule>
|
||||
|
||||
<!-- Closing brace should be at the same level as opening brace -->
|
||||
<!-- <rule ref="PEAR.WhiteSpace.ScopeClosingBrace">
|
||||
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace">
|
||||
<properties>
|
||||
<property name="indent" value="2"/>
|
||||
</properties>
|
||||
</rule> -->
|
||||
</rule>
|
||||
|
||||
<!-- Each class must be in a file by itself and must be under a namespace -->
|
||||
<!-- <rule ref="PSR1.Classes.ClassDeclaration"/> -->
|
||||
|
@@ -81,7 +81,9 @@ class ServicesTest extends MailPoetTest {
|
||||
$this->services_endpoint->bridge = Stub::make(
|
||||
new Bridge(),
|
||||
array(
|
||||
'checkMSSKey' => function() { throw new \Exception('test'); },
|
||||
'checkMSSKey' => function() {
|
||||
throw new \Exception('test');
|
||||
},
|
||||
'storeMSSKeyAndState' => Stub::never()
|
||||
),
|
||||
$this
|
||||
@@ -176,7 +178,9 @@ class ServicesTest extends MailPoetTest {
|
||||
$this->services_endpoint->bridge = Stub::make(
|
||||
new Bridge(),
|
||||
array(
|
||||
'checkPremiumKey' => function() { throw new \Exception('test'); },
|
||||
'checkPremiumKey' => function() {
|
||||
throw new \Exception('test');
|
||||
},
|
||||
'storePremiumKeyAndState' => Stub::never()
|
||||
),
|
||||
$this
|
||||
|
@@ -10,7 +10,9 @@ class RendererTest extends MailPoetTest {
|
||||
|
||||
function testItUsesCorrectAssetsManifestFilenames() {
|
||||
$renderer = Stub::make(new Renderer(),
|
||||
array('getAssetManifest' => function($manifest) { return $manifest; })
|
||||
array('getAssetManifest' => function($manifest) {
|
||||
return $manifest;
|
||||
})
|
||||
);
|
||||
$renderer->__construct();
|
||||
expect($renderer->assets_manifest_js)->equals(Env::$assets_path . '/js/manifest.json');
|
||||
@@ -71,7 +73,9 @@ class RendererTest extends MailPoetTest {
|
||||
array(
|
||||
'renderer' => Stub::makeEmpty('Twig_Environment',
|
||||
array(
|
||||
'render' => Stub::atLeastOnce(function() { return 'test render'; }),
|
||||
'render' => Stub::atLeastOnce(function() {
|
||||
return 'test render';
|
||||
}),
|
||||
),
|
||||
$this
|
||||
),
|
||||
|
@@ -69,10 +69,10 @@ class DaemonTest extends MailPoetTest {
|
||||
|
||||
function testItCanExecuteWorkers() {
|
||||
$daemon = Stub::make(new Daemon(true), array(
|
||||
'executeScheduleWorker' => Stub::exactly(1, function() { }),
|
||||
'executeQueueWorker' => Stub::exactly(1, function() { }),
|
||||
'pauseExecution' => function($a) { },
|
||||
'callSelf' => function() { }
|
||||
'executeScheduleWorker' => Stub::exactly(1),
|
||||
'executeQueueWorker' => Stub::exactly(1),
|
||||
'pauseExecution' => null,
|
||||
'callSelf' => null
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -90,8 +90,8 @@ class DaemonTest extends MailPoetTest {
|
||||
'executeQueueWorker' => function() {
|
||||
throw new \Exception();
|
||||
},
|
||||
'pauseExecution' => function($a) { },
|
||||
'callSelf' => function() { }
|
||||
'pauseExecution' => null,
|
||||
'callSelf' => null
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -103,13 +103,13 @@ class DaemonTest extends MailPoetTest {
|
||||
|
||||
function testItCanPauseExecution() {
|
||||
$daemon = Stub::make(new Daemon(true), array(
|
||||
'executeScheduleWorker' => function() { },
|
||||
'executeQueueWorker' => function() { },
|
||||
'executeScheduleWorker' => null,
|
||||
'executeQueueWorker' => null,
|
||||
'pauseExecution' => Stub::exactly(1, function($pause_delay) {
|
||||
expect($pause_delay)->lessThan(CronHelper::DAEMON_EXECUTION_LIMIT);
|
||||
expect($pause_delay)->greaterThan(CronHelper::DAEMON_EXECUTION_LIMIT - 1);
|
||||
}),
|
||||
'callSelf' => function() { }
|
||||
'callSelf' => null
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -125,9 +125,9 @@ class DaemonTest extends MailPoetTest {
|
||||
'executeScheduleWorker' => function() {
|
||||
Setting::deleteValue(CronHelper::DAEMON_SETTING);
|
||||
},
|
||||
'executeQueueWorker' => function() { },
|
||||
'pauseExecution' => function() { },
|
||||
'terminateRequest' => Stub::exactly(1, function() { })
|
||||
'executeQueueWorker' => null,
|
||||
'pauseExecution' => null,
|
||||
'terminateRequest' => Stub::exactly(1)
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -145,9 +145,9 @@ class DaemonTest extends MailPoetTest {
|
||||
array('token' => 567)
|
||||
);
|
||||
},
|
||||
'executeQueueWorker' => function() { },
|
||||
'pauseExecution' => function() { },
|
||||
'terminateRequest' => Stub::exactly(1, function() { })
|
||||
'executeQueueWorker' => null,
|
||||
'pauseExecution' => null,
|
||||
'terminateRequest' => Stub::exactly(1)
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -159,10 +159,10 @@ class DaemonTest extends MailPoetTest {
|
||||
|
||||
function testItUpdatesDaemonTokenDuringExecution() {
|
||||
$daemon = Stub::make(new Daemon(true), array(
|
||||
'executeScheduleWorker' => function() { },
|
||||
'executeQueueWorker' => function() { },
|
||||
'pauseExecution' => function() { },
|
||||
'callSelf' => function() { }
|
||||
'executeScheduleWorker' => null,
|
||||
'executeQueueWorker' => null,
|
||||
'pauseExecution' => null,
|
||||
'callSelf' => null
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
@@ -178,12 +178,12 @@ class DaemonTest extends MailPoetTest {
|
||||
ignore_user_abort(0);
|
||||
expect(ignore_user_abort())->equals(0);
|
||||
$daemon = Stub::make(new Daemon(true), array(
|
||||
'pauseExecution' => function() { },
|
||||
'pauseExecution' => null,
|
||||
// workers should be executed
|
||||
'executeScheduleWorker' => Stub::exactly(1, function() { }),
|
||||
'executeQueueWorker' => Stub::exactly(1, function() { }),
|
||||
'executeScheduleWorker' => Stub::exactly(1),
|
||||
'executeQueueWorker' => Stub::exactly(1),
|
||||
// daemon should call itself
|
||||
'callSelf' => Stub::exactly(1, function() { }),
|
||||
'callSelf' => Stub::exactly(1),
|
||||
), $this);
|
||||
$data = array(
|
||||
'token' => 123
|
||||
|
@@ -29,7 +29,9 @@ class KeyCheckWorkerTest extends MailPoetTest {
|
||||
$worker = Stub::make(
|
||||
$this->worker,
|
||||
array(
|
||||
'checkKey' => function () { throw new \Exception; },
|
||||
'checkKey' => function () {
|
||||
throw new \Exception;
|
||||
},
|
||||
'reschedule' => Stub::once()
|
||||
),
|
||||
$this
|
||||
|
@@ -213,7 +213,9 @@ class SchedulerTest extends MailPoetTest {
|
||||
|
||||
// return false when WP user cannot be verified
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'verifyWPSubscriber' => Stub::exactly(1, function() { return false; })
|
||||
'verifyWPSubscriber' => Stub::exactly(1, function() {
|
||||
return false;
|
||||
})
|
||||
), $this);
|
||||
expect($scheduler->processWelcomeNewsletter($newsletter, $queue))->false();
|
||||
}
|
||||
@@ -226,7 +228,9 @@ class SchedulerTest extends MailPoetTest {
|
||||
|
||||
// return false when subscriber cannot be verified
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'verifyMailpoetSubscriber' => Stub::exactly(1, function() { return false; })
|
||||
'verifyMailpoetSubscriber' => Stub::exactly(1, function() {
|
||||
return false;
|
||||
})
|
||||
), $this);
|
||||
expect($scheduler->processWelcomeNewsletter($newsletter, $queue))->false();
|
||||
}
|
||||
@@ -239,7 +243,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue = $this->_createQueue($newsletter->id);
|
||||
$queue->subscribers = serialize(array('to_process' => array(1)));
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'verifyMailpoetSubscriber' => Stub::exactly(1, function() { })
|
||||
'verifyMailpoetSubscriber' => Stub::exactly(1)
|
||||
), $this);
|
||||
expect($queue->status)->notNull();
|
||||
expect($scheduler->processWelcomeNewsletter($newsletter, $queue))->true();
|
||||
@@ -255,7 +259,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue = $this->_createQueue($newsletter->id);
|
||||
$queue->subscribers = serialize(array('to_process' => array(1)));
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'verifyWPSubscriber' => Stub::exactly(1, function() { })
|
||||
'verifyWPSubscriber' => Stub::exactly(1)
|
||||
), $this);
|
||||
expect($queue->status)->notNull();
|
||||
expect($scheduler->processWelcomeNewsletter($newsletter, $queue))->true();
|
||||
@@ -378,7 +382,9 @@ class SchedulerTest extends MailPoetTest {
|
||||
|
||||
// delete or reschedule queue when segments don't exist
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'deleteQueueOrUpdateNextRunDate' => Stub::exactly(1, function() { return false; })
|
||||
'deleteQueueOrUpdateNextRunDate' => Stub::exactly(1, function() {
|
||||
return false;
|
||||
})
|
||||
), $this);
|
||||
expect($scheduler->processPostNotificationNewsletter($newsletter, $queue))->false();
|
||||
}
|
||||
@@ -391,7 +397,9 @@ class SchedulerTest extends MailPoetTest {
|
||||
|
||||
// delete or reschedule queue when there are no subscribers in segments
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'deleteQueueOrUpdateNextRunDate' => Stub::exactly(1, function() { return false; })
|
||||
'deleteQueueOrUpdateNextRunDate' => Stub::exactly(1, function() {
|
||||
return false;
|
||||
})
|
||||
), $this);
|
||||
expect($scheduler->processPostNotificationNewsletter($newsletter, $queue))->false();
|
||||
}
|
||||
@@ -463,7 +471,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
|
||||
$queue->save();
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'processWelcomeNewsletter' => Stub::exactly(1, function($newsletter, $queue) { })
|
||||
'processWelcomeNewsletter' => Stub::exactly(1)
|
||||
), $this);
|
||||
$scheduler->timer = microtime(true);
|
||||
$scheduler->process();
|
||||
@@ -475,7 +483,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
|
||||
$queue->save();
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'processPostNotificationNewsletter' => Stub::exactly(1, function($newsletter, $queue) { })
|
||||
'processPostNotificationNewsletter' => Stub::exactly(1)
|
||||
), $this);
|
||||
$scheduler->timer = microtime(true);
|
||||
$scheduler->process();
|
||||
@@ -487,7 +495,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
|
||||
$queue->save();
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'processScheduledStandardNewsletter' => Stub::exactly(1, function($newsletter, $queue) { })
|
||||
'processScheduledStandardNewsletter' => Stub::exactly(1)
|
||||
), $this);
|
||||
$scheduler->timer = microtime(true);
|
||||
$scheduler->process();
|
||||
@@ -499,7 +507,7 @@ class SchedulerTest extends MailPoetTest {
|
||||
$queue->scheduled_at = Carbon::createFromTimestamp(current_time('timestamp'));
|
||||
$queue->save();
|
||||
$scheduler = Stub::make(new Scheduler(), array(
|
||||
'processPostNotificationNewsletter' => Stub::exactly(1, function($newsletter, $queue) { })
|
||||
'processPostNotificationNewsletter' => Stub::exactly(1)
|
||||
), $this);
|
||||
$scheduler->timer = microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT;
|
||||
try {
|
||||
|
@@ -122,14 +122,14 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = Stub::make(
|
||||
new SendingQueueWorker(),
|
||||
array(
|
||||
'enforceSendingAndExecutionLimits' => Stub::exactly(1, function() { })
|
||||
'enforceSendingAndExecutionLimits' => Stub::exactly(1)
|
||||
), $this);
|
||||
$sending_queue_worker->__construct(
|
||||
$timer = false,
|
||||
Stub::make(
|
||||
new MailerTask(),
|
||||
array(
|
||||
'send' => function() { }
|
||||
'send' => null
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -162,7 +162,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
Stub::make(
|
||||
new MailerTask(),
|
||||
array(
|
||||
'send' => function() { }
|
||||
'send' => null
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -187,7 +187,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
// this function returns a queue object
|
||||
return (object)array('status' => null);
|
||||
},
|
||||
'enforceSendingAndExecutionLimits' => Stub::exactly(2, function() { })
|
||||
'enforceSendingAndExecutionLimits' => Stub::exactly(2)
|
||||
), $this);
|
||||
$sending_queue_worker->__construct();
|
||||
$sending_queue_worker->process();
|
||||
@@ -306,7 +306,9 @@ class SendingQueueTest extends MailPoetTest {
|
||||
expect(!empty($newsletter[0]['body']['text']))->true();
|
||||
return true;
|
||||
}),
|
||||
'getProcessingMethod' => Stub::exactly(1, function() { return 'bulk'; })
|
||||
'getProcessingMethod' => Stub::exactly(1, function() {
|
||||
return 'bulk';
|
||||
})
|
||||
),
|
||||
$this
|
||||
)
|
||||
@@ -406,7 +408,9 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = $this->sending_queue_worker;
|
||||
$sending_queue_worker->mailer_task = Stub::make(
|
||||
new MailerTask(),
|
||||
array('send' => Stub::exactly(1, function($newsletter, $subscriber) { return true; })),
|
||||
array('send' => Stub::exactly(1, function() {
|
||||
return true;
|
||||
})),
|
||||
$this
|
||||
);
|
||||
$sending_queue_worker->process();
|
||||
@@ -445,7 +449,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = $this->sending_queue_worker;
|
||||
$sending_queue_worker->mailer_task = Stub::make(
|
||||
new MailerTask(),
|
||||
array('send' => function($newsletter, $subscriber) { return true; })
|
||||
array('send' => true)
|
||||
);
|
||||
$sending_queue_worker->process();
|
||||
|
||||
@@ -467,7 +471,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = $this->sending_queue_worker;
|
||||
$sending_queue_worker->mailer_task = Stub::make(
|
||||
new MailerTask(),
|
||||
array('send' => function($newsletter, $subscriber) { return true; })
|
||||
array('send' => true)
|
||||
);
|
||||
|
||||
// newsletter is sent to existing subscriber
|
||||
@@ -490,7 +494,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = $this->sending_queue_worker;
|
||||
$sending_queue_worker->mailer_task = Stub::make(
|
||||
new MailerTask(),
|
||||
array('send' => function($newsletter, $subscriber) { return true; })
|
||||
array('send' => true)
|
||||
);
|
||||
|
||||
// newsletter is not sent to globally unsubscribed subscriber
|
||||
@@ -508,7 +512,7 @@ class SendingQueueTest extends MailPoetTest {
|
||||
$sending_queue_worker = $this->sending_queue_worker;
|
||||
$sending_queue_worker->mailer_task = Stub::make(
|
||||
new MailerTask(),
|
||||
array('send' => function($newsletter, $subscriber) { return true; })
|
||||
array('send' => true)
|
||||
);
|
||||
|
||||
// newsletter is not sent to subscriber unsubscribed from segment
|
||||
|
@@ -107,7 +107,9 @@ class MailerTaskTest extends MailPoetTest {
|
||||
(object)array(
|
||||
'mailer_instance' => Stub::make(
|
||||
$php_mail_class,
|
||||
array('send' => Stub::exactly(1, function($newsletter, $subscriber) { return true; })),
|
||||
array('send' => Stub::exactly(1, function() {
|
||||
return true;
|
||||
})),
|
||||
$this
|
||||
)
|
||||
)
|
||||
|
@@ -37,7 +37,7 @@ class ViewInBrowserRouterTest extends MailPoetTest {
|
||||
|
||||
function testItAbortsWhenBrowserPreviewDataIsMissing() {
|
||||
$view_in_browser = Stub::make($this->view_in_browser, array(
|
||||
'_abort' => Stub::exactly(2, function() { })
|
||||
'_abort' => Stub::exactly(2)
|
||||
), $this);
|
||||
// newsletter ID is required
|
||||
$data = $this->browser_preview_data;
|
||||
@@ -51,7 +51,7 @@ class ViewInBrowserRouterTest extends MailPoetTest {
|
||||
|
||||
function testItAbortsWhenBrowserPreviewDataIsInvalid() {
|
||||
$view_in_browser = Stub::make($this->view_in_browser, array(
|
||||
'_abort' => Stub::exactly(3, function() { })
|
||||
'_abort' => Stub::exactly(3)
|
||||
), $this);
|
||||
// newsletter ID is invalid
|
||||
$data = $this->browser_preview_data;
|
||||
@@ -186,7 +186,7 @@ class ViewInBrowserRouterTest extends MailPoetTest {
|
||||
|
||||
function testItReturnsViewActionResult() {
|
||||
$view_in_browser = Stub::make($this->view_in_browser, array(
|
||||
'_displayNewsletter' => Stub::exactly(1, function() { })
|
||||
'_displayNewsletter' => Stub::exactly(1)
|
||||
), $this);
|
||||
$view_in_browser->data = $view_in_browser->_processBrowserPreviewData($this->browser_preview_data);
|
||||
$view_in_browser->view();
|
||||
|
@@ -49,7 +49,7 @@ class ClicksTest extends MailPoetTest {
|
||||
function testItAbortsWhenTrackDataIsEmptyOrMissingLink() {
|
||||
// abort function should be called twice:
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'abort' => Stub::exactly(2, function() { })
|
||||
'abort' => Stub::exactly(2)
|
||||
), $this);
|
||||
$data = $this->track_data;
|
||||
// 1. when tracking data does not exist
|
||||
@@ -64,7 +64,7 @@ class ClicksTest extends MailPoetTest {
|
||||
$data->subscriber->wp_user_id = 99;
|
||||
$data->preview = true;
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'redirectToUrl' => function() { }
|
||||
'redirectToUrl' => null
|
||||
), $this);
|
||||
$clicks->track($data);
|
||||
expect(StatisticsClicks::findMany())->isEmpty();
|
||||
@@ -74,7 +74,7 @@ class ClicksTest extends MailPoetTest {
|
||||
function testItTracksClickAndOpenEvent() {
|
||||
$data = $this->track_data;
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'redirectToUrl' => function() { }
|
||||
'redirectToUrl' => null
|
||||
), $this);
|
||||
$clicks->track($data);
|
||||
expect(StatisticsClicks::findMany())->notEmpty();
|
||||
@@ -83,14 +83,14 @@ class ClicksTest extends MailPoetTest {
|
||||
|
||||
function testItRedirectsToUrlAfterTracking() {
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'redirectToUrl' => Stub::exactly(1, function() { })
|
||||
'redirectToUrl' => Stub::exactly(1)
|
||||
), $this);
|
||||
$clicks->track($this->track_data);
|
||||
}
|
||||
|
||||
function testItIncrementsClickEventCount() {
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'redirectToUrl' => function() { }
|
||||
'redirectToUrl' => null
|
||||
), $this);
|
||||
$clicks->track($this->track_data);
|
||||
expect(StatisticsClicks::findMany()[0]->count)->equals(1);
|
||||
@@ -111,7 +111,7 @@ class ClicksTest extends MailPoetTest {
|
||||
|
||||
function testItFailsToConvertsInvalidShortcodeToUrl() {
|
||||
$clicks = Stub::make($this->clicks, array(
|
||||
'abort' => Stub::exactly(1, function() { })
|
||||
'abort' => Stub::exactly(1)
|
||||
), $this);
|
||||
// should call abort() method if shortcode action does not exist
|
||||
$link = $clicks->processUrl(
|
||||
|
@@ -38,7 +38,7 @@ class OpensTest extends MailPoetTest {
|
||||
|
||||
function testItReturnsImageWhenTrackDataIsEmpty() {
|
||||
$opens = Stub::make($this->opens, array(
|
||||
'returnResponse' => Stub::exactly(1, function() { })
|
||||
'returnResponse' => Stub::exactly(1)
|
||||
), $this);
|
||||
$opens->track(false);
|
||||
expect(StatisticsOpens::findMany())->isEmpty();
|
||||
@@ -49,7 +49,7 @@ class OpensTest extends MailPoetTest {
|
||||
$data->subscriber->wp_user_id = 99;
|
||||
$data->preview = true;
|
||||
$opens = Stub::make($this->opens, array(
|
||||
'returnResponse' => function() { }
|
||||
'returnResponse' => null
|
||||
), $this);
|
||||
$opens->track($data);
|
||||
expect(StatisticsOpens::findMany())->isEmpty();
|
||||
@@ -61,7 +61,7 @@ class OpensTest extends MailPoetTest {
|
||||
|
||||
function testItTracksOpenEvent() {
|
||||
$opens = Stub::make($this->opens, array(
|
||||
'returnResponse' => function() { }
|
||||
'returnResponse' => null
|
||||
), $this);
|
||||
$opens->track($this->track_data);
|
||||
expect(StatisticsOpens::findMany())->notEmpty();
|
||||
@@ -69,7 +69,7 @@ class OpensTest extends MailPoetTest {
|
||||
|
||||
function testItDoesNotTrackRepeatedOpenEvents() {
|
||||
$opens = Stub::make($this->opens, array(
|
||||
'returnResponse' => function() { }
|
||||
'returnResponse' => null
|
||||
), $this);
|
||||
for($count = 0; $count <= 2; $count++) {
|
||||
$opens->track($this->track_data);
|
||||
@@ -79,7 +79,7 @@ class OpensTest extends MailPoetTest {
|
||||
|
||||
function testItReturnsImageAfterTracking() {
|
||||
$opens = Stub::make($this->opens, array(
|
||||
'returnResponse' => Stub::exactly(1, function() { })
|
||||
'returnResponse' => Stub::exactly(1)
|
||||
), $this);
|
||||
$opens->track($this->track_data);
|
||||
}
|
||||
|
@@ -52,7 +52,9 @@ class SubscriptionFormSubmissionTest extends MailPoetTest {
|
||||
|
||||
function testItSubscribesAndRedirectsBackWithSuccessResponse() {
|
||||
$mock = Mock::double('MailPoet\Util\Url', [
|
||||
'redirectBack' => function($params) { return $params; }
|
||||
'redirectBack' => function($params) {
|
||||
return $params;
|
||||
}
|
||||
]);
|
||||
$result = Form::onSubmit($this->request_data);
|
||||
expect(SubscriberModel::findOne($this->request_data['data']['email']))->notEmpty();
|
||||
@@ -70,7 +72,9 @@ class SubscriptionFormSubmissionTest extends MailPoetTest {
|
||||
$form->settings = serialize($form_settings);
|
||||
$form->save();
|
||||
$mock = Mock::double('MailPoet\Util\Url', [
|
||||
'redirectTo' => function($params) { return $params; }
|
||||
'redirectTo' => function($params) {
|
||||
return $params;
|
||||
}
|
||||
]);
|
||||
$result = Form::onSubmit($this->request_data);
|
||||
expect(SubscriberModel::findOne($this->request_data['data']['email']))->notEmpty();
|
||||
@@ -83,7 +87,9 @@ class SubscriptionFormSubmissionTest extends MailPoetTest {
|
||||
$request_data = $this->request_data;
|
||||
$request_data['data']['email'] = false;
|
||||
$mock = Mock::double('MailPoet\Util\Url', [
|
||||
'redirectBack' => function($params) { return $params; }
|
||||
'redirectBack' => function($params) {
|
||||
return $params;
|
||||
}
|
||||
]);
|
||||
$result = Form::onSubmit($request_data);
|
||||
expect(SubscriberModel::findMany())->isEmpty();
|
||||
|
Reference in New Issue
Block a user