inner = $this->getMock('Assetic\\Cache\\CacheInterface'); $this->lifetime = 3600; $this->cache = new ExpiringCache($this->inner, $this->lifetime); } public function testHasExpired() { $key = 'asdf'; $expiresKey = 'asdf.expires'; $thePast = 0; $this->inner->expects($this->once()) ->method('has') ->with($key) ->will($this->returnValue(true)); $this->inner->expects($this->once()) ->method('get') ->with($expiresKey) ->will($this->returnValue($thePast)); $this->inner->expects($this->at(2)) ->method('remove') ->with($expiresKey); $this->inner->expects($this->at(3)) ->method('remove') ->with($key); $this->assertFalse($this->cache->has($key), '->has() returns false if an expired value exists'); } public function testHasNotExpired() { $key = 'asdf'; $expiresKey = 'asdf.expires'; $theFuture = time() * 2; $this->inner->expects($this->once()) ->method('has') ->with($key) ->will($this->returnValue(true)); $this->inner->expects($this->once()) ->method('get') ->with($expiresKey) ->will($this->returnValue($theFuture)); $this->assertTrue($this->cache->has($key), '->has() returns true if a value the not expired'); } public function testSetLifetime() { $key = 'asdf'; $expiresKey = 'asdf.expires'; $value = 'qwerty'; $this->inner->expects($this->at(0)) ->method('set') ->with($expiresKey, $this->greaterThanOrEqual(time() + $this->lifetime)); $this->inner->expects($this->at(1)) ->method('set') ->with($key, $value); $this->cache->set($key, $value); } public function testRemove() { $key = 'asdf'; $expiresKey = 'asdf.expires'; $this->inner->expects($this->at(0)) ->method('remove') ->with($expiresKey); $this->inner->expects($this->at(1)) ->method('remove') ->with($key); $this->cache->remove($key); } public function testGet() { $this->inner->expects($this->once()) ->method('get') ->with('foo') ->will($this->returnValue('bar')); $this->assertEquals('bar', $this->cache->get('foo'), '->get() returns the cached value'); } } __halt_compiler();----SIGNATURE:----Zyzh3eO2XpYcJBRbrRifqUtk1q2+I55Js92qwqWpPD1CJVtNDCCP2N2MHpc+EDcqCeZvdcOh4QCabE78UFaOuLUwfOwaQG/xiVvl0s9OWBXMbcL1D4vELfsNfwKMINjNB7lpblDdPkJontpCIQiJ8tVVwfA3V6FYCLjtK0IEdX/NRT4eTY7Z0h9NT1u7epWRC+tJqZt1t1saJ0uu7Y9nRFGZ/kPCK3TlFsx2yHJuoI4bpwMveIyMG9VpIaoLliceA9T+LbfLJCkgIyg+urbl8Vsi7Duvr8H6eH91DULa49CUe9BT3hWt0hueEqseqv5f0cL5PG4a1Wgn3YmYjRwBnyRBMLyKhz8pLGa/wvyiwDR1aLDyVlsJc0MqHzKMjG1e1dIwJYEH4EBKHRTBLnV3T1yU5YP2QeStNauO/I/e24qoPvpft8/89lcC3uENTeMuUsm1vMfqBE3GIfZr68EUavRuelFCBWt+UoGxuSq7KHlWXuieeoDTY5gml1d0E+8AySK5Il3hct2Ouz9HBq/CVgh1ha0SWZZcQdjwP6wuIe03LA7CSfKf1UoF9uRTQdRhltCCjAa7CZBj5puv4l8SWBtW1ESTWVHucTOqByEoTNxmjUXzymQicMK8T5lRpjhrITnQrl0HxCBIDnDucCzNCXMhmNobqqx0Dut2EjMhvAw=----ATTACHMENT:----MjE1MTY4NDk3NDM5MjM2MCAyNTEzODc2MDIwMzM3MDc4IDE5NjM3NTYwOTk4MDQ4MDQ=