function let(MetroFactory $factory, Redis $redis) { $this->beConstructedWith($factory); $factory->getRedis()->willReturn($redis); $factory->createKeyspace($redis)->willReturn(new Keyspace($redis->getWrappedObject())); Clock::setNowForTests(1429362976.2634); }
function let(MetroFactory $factory, Redis $redis, Redis $tx) { $this->beConstructedWith($this->createJob(), $factory); Clock::setNowForTests(1429362976.2634); $factory->getRedis()->willReturn($redis); $factory->createKeyspace($redis)->willReturn(new Keyspace($redis->getWrappedObject())); $factory->createKeyspace($tx)->willReturn(new Keyspace($tx->getWrappedObject())); $options['retry'] = 3; $options['cas'] = true; $redis->transaction($options, Argument::any())->will(function ($args) use($tx) { $args[1]($tx->getWrappedObject()); }); }