public function testCreateWithGetCacheItemThrowsCacheException() { $decoratedPropertyNameCollectionFactory = $this->prophesize(PropertyNameCollectionFactoryInterface::class); $decoratedPropertyNameCollectionFactory->create(Dummy::class, [])->willReturn(new PropertyNameCollection(['id', 'name', 'description', 'dummy']))->shouldBeCalled(); $cacheException = $this->prophesize(CacheException::class); $cacheException->willExtend(\Exception::class); $cacheItemPool = $this->prophesize(CacheItemPoolInterface::class); $cacheItemPool->getItem($this->generateCacheKey())->willThrow($cacheException->reveal())->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); }