public function testGetData_serializesClosure() { $testClosure = function () { $this->fail('should never be executed'); }; $expectedData = (new Serializer())->serialize($testClosure); $command = new ClosureCommand(); $command->setClosure($testClosure); $data = $command->getData(); $this->assertEquals($expectedData, $data); }
public function queueClosure(\Closure $closure, $tube = Beanie::DEFAULT_TUBE, $priority = Beanie::DEFAULT_PRIORITY, $delay = Beanie::DEFAULT_DELAY, $timeToRun = Beanie::DEFAULT_TIME_TO_RUN) { $closureCommand = new ClosureCommand(); $closureCommand->setClosure($closure); $this->queue($closureCommand, $tube, $priority, $delay, $timeToRun); }