ApiPlatform\Core\Tests\Metadata\Property\Factory\CachedPropertyMetadataFactoryTest::testCreateWithGetCacheItemThrowsCacheException PHP Method

testCreateWithGetCacheItemThrowsCacheException() public method

    public function testCreateWithGetCacheItemThrowsCacheException()
    {
        $decoratedPropertyMetadataFactory = $this->prophesize(PropertyMetadataFactoryInterface::class);
        $decoratedPropertyMetadataFactory->create(Dummy::class, 'dummy', [])->willReturn(new PropertyMetadata(null, 'A dummy', true, true, null, null, false, false))->shouldBeCalled();
        $cacheException = $this->prophesize(CacheException::class);
        $cacheException->willExtend(\Exception::class);
        $cacheItemPool = $this->prophesize(CacheItemPoolInterface::class);
        $cacheItemPool->getItem($this->generateCacheKey())->willThrow($cacheException->reveal())->shouldBeCalled();
        $cachedPropertyMetadataFactory = new CachedPropertyMetadataFactory($cacheItemPool->reveal(), $decoratedPropertyMetadataFactory->reveal());
        $resultedPropertyMetadata = $cachedPropertyMetadataFactory->create(Dummy::class, 'dummy');
        $this->assertInstanceOf(PropertyMetadata::class, $resultedPropertyMetadata);
        $this->assertEquals(new PropertyMetadata(null, 'A dummy', true, true, null, null, false, false), $resultedPropertyMetadata);
    }