/** * @covers Symfony\Component\Routing\Loader\LoaderResolver::resolve */ public function testResolve() { $resolver = new LoaderResolver(array($loader = new ClosureLoader())); $this->assertFalse($resolver->resolve('foo.foo'), '->resolve() returns false if no loader is able to load the resource'); $this->assertEquals($loader, $resolver->resolve(function () { }), '->resolve() returns the loader for the given resource'); }
/** * Returns a loader able to load the resource. * * @param mixed $resource A resource * * @return LoaderInterface A LoaderInterface instance */ public function resolve($resource) { if (count($this->services)) { while ($id = array_shift($this->services)) { $this->addLoader($this->container->get($id)); } } return parent::resolve($resource); }