public function testCreateWithItemNotHit()
{
$resourceNameCollection = new PropertyNameCollection(['id', 'name', 'description', 'dummy']);
$decoratedPropertyNameCollectionFactory = $this->prophesize(PropertyNameCollectionFactoryInterface::class);
$decoratedPropertyNameCollectionFactory->create(Dummy::class, [])->willReturn($resourceNameCollection)->shouldBeCalled();
$cacheItem = $this->prophesize(CacheItemInterface::class);
$cacheItem->isHit()->willReturn(false)->shouldBeCalled();
$cacheItem->set($resourceNameCollection)->willReturn($cacheItem->reveal())->shouldBeCalled();
$cacheItemPool = $this->prophesize(CacheItemPoolInterface::class);
$cacheItemPool->getItem($this->generateCacheKey())->willReturn($cacheItem->reveal())->shouldBeCalled();
$cacheItemPool->save($cacheItem->reveal())->willReturn(true)->shouldBeCalled();
$cachedPropertyNameCollectionFactory = new CachedPropertyNameCollectionFactory($cacheItemPool->reveal(), $decoratedPropertyNameCollectionFactory->reveal());
$resultedPropertyNameCollection = $cachedPropertyNameCollectionFactory->create(Dummy::class);
$this->assertInstanceOf(PropertyNameCollection::class, $resultedPropertyNameCollection);
$this->assertEquals(new PropertyNameCollection(['id', 'name', 'description', 'dummy']), $resultedPropertyNameCollection);
}