public function testCreateWithItemNotHit()
{
$propertyMetadata = new PropertyMetadata(null, 'A dummy', true, true, null, null, false, false);
$decoratedPropertyMetadataFactory = $this->prophesize(PropertyMetadataFactoryInterface::class);
$decoratedPropertyMetadataFactory->create(Dummy::class, 'dummy', [])->willReturn($propertyMetadata)->shouldBeCalled();
$cacheItem = $this->prophesize(CacheItemInterface::class);
$cacheItem->isHit()->willReturn(false)->shouldBeCalled();
$cacheItem->set($propertyMetadata)->willReturn($cacheItem->reveal())->shouldBeCalled();
$cacheItemPool = $this->prophesize(CacheItemPoolInterface::class);
$cacheItemPool->getItem($this->generateCacheKey())->willReturn($cacheItem->reveal())->shouldBeCalled();
$cacheItemPool->save($cacheItem->reveal())->willReturn(true)->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);
}