Replace constant in tests
[MAILPOET-2367]
This commit is contained in:
committed by
Jack Kitterhing
parent
1bedf1fd1a
commit
910b62cd70
@@ -258,7 +258,7 @@ class CronHelperTest extends \MailPoetTest {
|
|||||||
$time = microtime(true);
|
$time = microtime(true);
|
||||||
expect(CronHelper::enforceExecutionLimit($time))->null();
|
expect(CronHelper::enforceExecutionLimit($time))->null();
|
||||||
try {
|
try {
|
||||||
CronHelper::enforceExecutionLimit($time - CronHelper::DAEMON_EXECUTION_LIMIT);
|
CronHelper::enforceExecutionLimit($time - CronHelper::getDaemonExecutionLimit());
|
||||||
self::fail('Execution limit exception not thrown.');
|
self::fail('Execution limit exception not thrown.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
expect($e->getMessage())->equals('Maximum execution time has been reached.');
|
expect($e->getMessage())->equals('Maximum execution time has been reached.');
|
||||||
|
@@ -95,8 +95,8 @@ class DaemonHttpRunnerTest extends \MailPoetTest {
|
|||||||
$daemon = $this->makeEmpty(Daemon::class);
|
$daemon = $this->makeEmpty(Daemon::class);
|
||||||
$daemon_http_runner = $this->make(DaemonHttpRunner::class, [
|
$daemon_http_runner = $this->make(DaemonHttpRunner::class, [
|
||||||
'pauseExecution' => Expected::exactly(1, function($pause_delay) {
|
'pauseExecution' => Expected::exactly(1, function($pause_delay) {
|
||||||
expect($pause_delay)->lessThan(CronHelper::DAEMON_EXECUTION_LIMIT);
|
expect($pause_delay)->lessThan(CronHelper::getDaemonExecutionLimit());
|
||||||
expect($pause_delay)->greaterThan(CronHelper::DAEMON_EXECUTION_LIMIT - 1);
|
expect($pause_delay)->greaterThan(CronHelper::getDaemonExecutionLimit() - 1);
|
||||||
}),
|
}),
|
||||||
'callSelf' => null,
|
'callSelf' => null,
|
||||||
'terminateRequest' => null,
|
'terminateRequest' => null,
|
||||||
|
@@ -95,7 +95,7 @@ class InactiveSubscribersTest extends \MailPoetTest {
|
|||||||
'reactivateInactiveSubscribers' => Stub\Expected::never(),
|
'reactivateInactiveSubscribers' => Stub\Expected::never(),
|
||||||
], $this);
|
], $this);
|
||||||
|
|
||||||
$worker = new InactiveSubscribers($controller_mock, $this->settings, microtime(true) - (CronHelper::DAEMON_EXECUTION_LIMIT - 1));
|
$worker = new InactiveSubscribers($controller_mock, $this->settings, microtime(true) - (CronHelper::getDaemonExecutionLimit() - 1));
|
||||||
sleep(1);
|
sleep(1);
|
||||||
$this->setExpectedException(\Exception::class, 'Maximum execution time has been reached.');
|
$this->setExpectedException(\Exception::class, 'Maximum execution time has been reached.');
|
||||||
$worker->processTaskStrategy(ScheduledTask::createOrUpdate([]));
|
$worker->processTaskStrategy(ScheduledTask::createOrUpdate([]));
|
||||||
|
@@ -32,7 +32,7 @@ class SchedulerTest extends \MailPoetTest {
|
|||||||
|
|
||||||
function testItThrowsExceptionWhenExecutionLimitIsReached() {
|
function testItThrowsExceptionWhenExecutionLimitIsReached() {
|
||||||
try {
|
try {
|
||||||
$scheduler = new Scheduler($this->makeEmpty(SubscribersFinder::class), microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT);
|
$scheduler = new Scheduler($this->makeEmpty(SubscribersFinder::class), microtime(true) - CronHelper::getDaemonExecutionLimit());
|
||||||
self::fail('Maximum execution time limit exception was not thrown.');
|
self::fail('Maximum execution time limit exception was not thrown.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
expect($e->getMessage())->equals('Maximum execution time has been reached.');
|
expect($e->getMessage())->equals('Maximum execution time has been reached.');
|
||||||
@@ -540,7 +540,7 @@ class SchedulerTest extends \MailPoetTest {
|
|||||||
$scheduler = Stub::make(Scheduler::class, [
|
$scheduler = Stub::make(Scheduler::class, [
|
||||||
'processPostNotificationNewsletter' => Expected::exactly(1),
|
'processPostNotificationNewsletter' => Expected::exactly(1),
|
||||||
], $this);
|
], $this);
|
||||||
$scheduler->timer = microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT;
|
$scheduler->timer = microtime(true) - CronHelper::getDaemonExecutionLimit();
|
||||||
try {
|
try {
|
||||||
$scheduler->process();
|
$scheduler->process();
|
||||||
self::fail('Maximum execution time limit exception was not thrown.');
|
self::fail('Maximum execution time limit exception was not thrown.');
|
||||||
|
@@ -38,8 +38,8 @@ class SimpleWorkerTest extends \MailPoetTest {
|
|||||||
|
|
||||||
function testItThrowsExceptionWhenExecutionLimitIsReached() {
|
function testItThrowsExceptionWhenExecutionLimitIsReached() {
|
||||||
try {
|
try {
|
||||||
$worker = new MockSimpleWorker(
|
new MockSimpleWorker(
|
||||||
microtime(true) - CronHelper::DAEMON_EXECUTION_LIMIT
|
microtime(true) - CronHelper::getDaemonExecutionLimit()
|
||||||
);
|
);
|
||||||
self::fail('Maximum execution time limit exception was not thrown.');
|
self::fail('Maximum execution time limit exception was not thrown.');
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
Reference in New Issue
Block a user