/** * @test */ public function getByTagCallsBackendAndReturnsIdentifiersAndValuesOfEntries() { $tag = 'sometag'; $identifiers = array('one', 'two'); $entries = array('one' => 'one value', 'two' => 'two value'); $backend = $this->getMockBuilder(\TYPO3\Flow\Cache\Backend\AbstractBackend::class)->disableOriginalConstructor()->setMethods(array('get', 'set', 'has', 'remove', 'findIdentifiersByTag', 'flush', 'flushByTag', 'collectGarbage'))->getMock(); $backend->expects($this->once())->method('findIdentifiersByTag')->with($this->equalTo($tag))->will($this->returnValue($identifiers)); $backend->expects($this->exactly(2))->method('get')->will($this->onConsecutiveCalls('one value', 'two value')); $cache = new \TYPO3\Flow\Cache\Frontend\StringFrontend('StringFrontend', $backend); $this->assertEquals($entries, $cache->getByTag($tag), 'Did not receive the expected entries'); }