getMock('Doctrine\Common\Cache\Cache'); $cache ->expects($this->at(0)) ->method('fetch') ->with($this->equalTo($cacheKey)) ->will($this->returnValue(array())) ; $cache ->expects($this->at(1)) ->method('fetch') ->with($this->equalTo('[C]'.$cacheKey)) ->will($this->returnValue(time() - 10)) ; $cache ->expects($this->at(2)) ->method('save') ->with($this->equalTo($cacheKey)) ; $cache ->expects($this->at(3)) ->method('save') ->with($this->equalTo('[C]'.$cacheKey)) ; $reader = new CachedReader(new AnnotationReader(), $cache, true); $this->assertEquals(array( new Route(array('value' => '/someprefix')), ), $reader->getClassAnnotations(new \ReflectionClass($name))); } protected function getReader() { $this->cache = new ArrayCache(); return new CachedReader(new AnnotationReader(), $this->cache); } }