public function testGetRouteNameForCollectionRouteOnCacheHit() { $cacheItemProphecy = $this->prophesize(CacheItemInterface::class); $cacheItemProphecy->isHit()->willReturn(true)->shouldBeCalled(); $cacheItemProphecy->get()->willReturn('some_collection_route')->shouldBeCalled(); $cacheItemPoolProphecy = $this->prophesize(CacheItemPoolInterface::class); $cacheItemPoolProphecy->getItem(Argument::type('string'))->willReturn($cacheItemProphecy); $cacheItemPoolProphecy->save($cacheItemProphecy)->shouldNotBeCalled(); $decoratedProphecy = $this->prophesize(RouteNameResolverInterface::class); $decoratedProphecy->getRouteName(Argument::cetera())->shouldNotBeCalled(); $cachedRouteNameResolver = new CachedRouteNameResolver($cacheItemPoolProphecy->reveal(), $decoratedProphecy->reveal()); $actual = $cachedRouteNameResolver->getRouteName('AppBundle\\Entity\\User', true); $this->assertSame('some_collection_route', $actual); }