public function testGetMetadataUndefinedClassWithCache() { $this->configProvider->expects($this->once())->method('hasConfig')->with('UndefinedClass')->willReturn(false); $this->configProvider->expects($this->never())->method('getConfig'); $this->cache->expects($this->at(0))->method('fetch')->with('UndefinedClass')->willReturn(false); $this->cache->expects($this->at(2))->method('fetch')->with('UndefinedClass')->willReturn(true); $this->cache->expects($this->once())->method('save')->with('UndefinedClass', true); $metadata = new FrontendOwnershipMetadata(); $providerWithCleanCache = clone $this->provider; // no cache $this->assertEquals($metadata, $this->provider->getMetadata('UndefinedClass')); // local cache $this->assertEquals($metadata, $this->provider->getMetadata('UndefinedClass')); // cache $this->assertEquals($metadata, $providerWithCleanCache->getMetadata('UndefinedClass')); }