public function testRetrieveResultListFromInjectedListLookup() { $expectedCacheItem = array('time' => 42, 'list' => serialize(array('Foo'))); $listLookup = $this->getMockBuilder('\\SMW\\SQLStore\\ListLookup')->disableOriginalConstructor()->getMock(); $listLookup->expects($this->once())->method('fetchList')->will($this->returnValue(array('Foo'))); $listLookup->expects($this->once())->method('getTimestamp')->will($this->returnValue(42)); $cache = $this->getMockBuilder('\\Onoi\\Cache\\Cache')->disableOriginalConstructor()->getMock(); $cache->expects($this->once())->method('save')->with($this->stringContains('lookup-cache'), $this->anything($expectedCacheItem), $this->equalTo(1001)); $cacheOptions = new \stdClass(); $cacheOptions->useCache = false; $cacheOptions->ttl = 1001; $instance = new CachedListLookup($listLookup, $cache, $cacheOptions); $this->assertEquals(array('Foo'), $instance->fetchList()); $this->assertEquals(42, $instance->getTimestamp()); $this->assertFalse($instance->isCached()); }