/** * @test */ public function setUsesProvidedLifetime() { $defaultLifetime = 3600; $this->backend->setDefaultLifetime($defaultLifetime); $expected = array('ex' => 1600); $this->redis->expects($this->any())->method('multi')->willReturn($this->redis); $this->redis->expects($this->once())->method('set')->with($this->anything(), $this->anything(), $expected)->willReturn($this->redis); $this->backend->set('foo', 'bar', array(), 1600); }
/** * @test Implementation */ public function setOverwritesExistingEntryWithNewDefaultLifetime() { $this->setUpBackend(); $this->setUpRedis(); $data = 'data'; $identifier = 'identifier' . uniqid(); $lifetime = 42; $this->backend->set($identifier, $data, array(), $lifetime); $newDefaultLifetime = 43; $this->backend->setDefaultLifetime($newDefaultLifetime); $this->backend->set($identifier, $data, array(), $newDefaultLifetime); $lifetimeRegisteredInBackend = $this->redis->ttl('identData:' . $identifier); $this->assertSame($newDefaultLifetime, $lifetimeRegisteredInBackend); }