ApiPlatform\Core\Tests\Metadata\Resource\Factory\CachedResourceMetadataFactoryTest::testCreateWithGetCacheItemThrowsCacheException PHP Method

testCreateWithGetCacheItemThrowsCacheException() public method

    public function testCreateWithGetCacheItemThrowsCacheException()
    {
        $decoratedResourceMetadataFactory = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $decoratedResourceMetadataFactory->create(Dummy::class)->willReturn(new ResourceMetadata(null, 'Dummy.'))->shouldBeCalled();
        $cacheException = $this->prophesize(CacheException::class);
        $cacheException->willExtend(\Exception::class);
        $cacheItemPool = $this->prophesize(CacheItemPoolInterface::class);
        $cacheItemPool->getItem($this->generateCacheKey())->willThrow($cacheException->reveal())->shouldBeCalled();
        $cachedResourceMetadataFactory = new CachedResourceMetadataFactory($cacheItemPool->reveal(), $decoratedResourceMetadataFactory->reveal());
        $resultedResourceMetadata = $cachedResourceMetadataFactory->create(Dummy::class);
        $this->assertInstanceOf(ResourceMetadata::class, $resultedResourceMetadata);
        $this->assertEquals(new ResourceMetadata(null, 'Dummy.'), $resultedResourceMetadata);
    }