private function cacheResolverFactory($config, ContainerInterface $container) { $cachePool = $container->get('\\Psr\\Cache\\CacheItemPoolInterface'); $resolver = new CacheResolver($cachePool); $resolver->setIsCompiled(true); return $resolver; }
public function testNamespacedDefaultResolved() { $cacheProphesy = $this->prophesize(CacheItemPoolInterface::class); $itemProphesy = $this->prophesize(CacheItemInterface::class); $cacheProphesy->getItem(Argument::type('string'))->will(function ($args) use($itemProphesy) { $isHit = $args[0] == AbstractResolver::DEFAULT_NAMESPACE . '::test'; $itemProphesy->isHit()->willReturn($isHit); $itemProphesy->get()->willReturn($isHit ? "test\n" : null); return $itemProphesy->reveal(); }); $resolver = new CacheResolver($cacheProphesy->reveal()); $result = $resolver->resolve('test::test'); $this->assertNotNull($result); $this->assertEquals("test\n", (string) $result); }