public function testPerfPuttingThenPoppingJobs() { $queue = new Qless\Queue("testQueue", $this->client); $cb = $this->getProfilerForCallback(function ($e) use($queue) { $queue->put("Sample\\TestWorkerImpl", $e, []); }); $cb(self::TEST_TIME, __METHOD__); $cb = $this->getProfilerForCallback(function ($e) use($queue) { $queue->pop('worker'); }); $cb(self::TEST_TIME, __METHOD__); }
/** * @expectedException \Qless\InvalidJobException */ public function testThrowsInvalidJobExceptionWhenRequeuingCancelledJob() { $queue = new Qless\Queue("testQueue", $this->client); $testData = ["performMethod" => 'myPerformMethod', "payload" => "otherData"]; $queue->put("Sample\\TestWorkerImpl", "jid-1", $testData, 0, 0, true, 1, [], 5, ['tag1', 'tag2']); $job = $queue->pop("worker-1")[0]; $this->client->cancel('jid-1'); $job->requeue(); }
public function testJobWithIntervalIsThrottled() { $queue = new Qless\Queue("testQueue", $this->client); $queue->put("Sample\\TestWorkerImpl", "jid-1", [], 0, 5, true, 0, [], 60); $job = $queue->pop('worker')[0]; $job->complete(); $queue->put("Sample\\TestWorkerImpl", "jid-1", [], 0, 5, true, 0, [], 60); $job = $queue->pop('worker'); $this->assertEmpty($job); }