public function testLoadLocationsByContentHasCache() { $this->loggerMock->expects($this->never())->method($this->anything()); $this->persistenceHandlerMock->expects($this->never())->method($this->anything()); $cacheItemMock = $this->getMock('Stash\\Interfaces\\ItemInterface'); $this->cacheMock->expects($this->at(0))->method('getItem')->with('content', 'locations', 44)->will($this->returnValue($cacheItemMock)); $cacheItemMock->expects($this->once())->method('get')->will($this->returnValue(array(33))); $cacheItemMock->expects($this->once())->method('isMiss')->will($this->returnValue(false)); $cacheItemMock->expects($this->never())->method('set'); // inline call to load() $cacheItemMock2 = $this->getMock('Stash\\Interfaces\\ItemInterface'); $this->cacheMock->expects($this->at(1))->method('getItem')->with('location', 33)->will($this->returnValue($cacheItemMock2)); $cacheItemMock2->expects($this->once())->method('get')->will($this->returnValue(new Location(array('id' => 33)))); $cacheItemMock2->expects($this->once())->method('isMiss')->will($this->returnValue(false)); $cacheItemMock2->expects($this->never())->method('set'); $handler = $this->persistenceCacheHandler->locationHandler(); $handler->loadLocationsByContent(44); }