/** * @inheritDoc */ public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $config = $container->get('config'); $prioritizedPathsResolver = new PrioritizedPathsResolver(); $paths = isset($config['asset_manager']['resolver_configs']['prioritized_paths']) ? $config['asset_manager']['resolver_configs']['prioritized_paths'] : array(); $prioritizedPathsResolver->addPaths($paths); return $prioritizedPathsResolver; }
/** * {@inheritDoc} * * @return PrioritizedPathsResolver */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('config'); $prioritizedPathsResolver = new PrioritizedPathsResolver(); $paths = isset($config['asset_manager']['resolver_configs']['prioritized_paths']) ? $config['asset_manager']['resolver_configs']['prioritized_paths'] : array(); $prioritizedPathsResolver->addPaths($paths); return $prioritizedPathsResolver; }
public function testWillRefuseInvalidPath() { $resolver = new PrioritizedPathsResolver(); $this->setExpectedException('AssetManager\\Exception\\InvalidArgumentException'); $resolver->addPath(null); }
/** * Test Collect returns valid list of assets * * @covers \AssetManager\Resolver\PrioritizedPathsResolver::collect */ public function testCollectDirectory() { $resolver = new PrioritizedPathsResolver(); $resolver->addPath(realpath(__DIR__ . '/../')); $dir = substr(__DIR__, strrpos(__DIR__, '/', 0) + 1); $this->assertContains($dir . DIRECTORY_SEPARATOR . basename(__FILE__), $resolver->collect()); $this->assertNotContains($dir . DIRECTORY_SEPARATOR . 'i-do-not-exist.php', $resolver->collect()); }