// Assert that the delay interval is greater than the lease interval. This
// allows us to assume that (if updated) the new expiry time will be greater
// than the initial expiry time. We can then also assume that the new expiry
// time offset will be identical to the delay interval.
$this->
assertGreaterThan($database_lease_time, CronQueueTestDatabaseDelayException::DELAY_INTERVAL
);
$this->
assertGreaterThan($this->currentTime +
$database_lease_time,
$expire);
$this->
assertEquals(CronQueueTestDatabaseDelayException::DELAY_INTERVAL,
$expire -
$this->currentTime
);
// Ensure that the memory queue expiry time is unchanged after the
// DelayedRequeueException has been thrown.
$property =
(new \
ReflectionClass($memory))->
getProperty('queue'
);
$memory_queue_internal =
$property->
getValue($memory);
$this->
assertEquals($this->currentTime +
$memory_lease_time,
reset($memory_queue_internal)->expire
);
} /**
* Tests that leases are expiring correctly, also within the same request.
*/
public function testLeaseTime() { $queue =
$this->container->
get('queue'
)->
get('cron_queue_test_lease_time'
);
$queue->
createItem([$this->
randomMachineName() =>
$this->
randomMachineName()]);
// Run initial queue job and ensure lease time variable is initialized.