public function testSetWise() { $loader = new ExampleFileLoader(new FileLocator()); $this->resolver->addLoader($loader); $this->resolver->setWise($this->wise); $this->assertSame($this->wise, $loader->getWise()); }
public function setSetLoaderDelegator() { $this->setPropertyValue($this->wise, 'collector', $this->collector); $resolver = new LoaderResolver(); $loader = new DelegatingLoader($resolver); $this->wise->setLoader($loader); $this->assertSame($this->collector, $resolver->getResourceCollector()); $this->assertSame($this->wise, $resolver->getWise()); }
/** * Creates a pre-configured instance of Wise. * * @param array|string $paths The configuration directory path(s). * @param string $cache The cache directory path. * @param boolean $debug Enable debugging? * * @return Wise The instance. */ public static function create($paths, $cache = null, $debug = false) { $wise = new self($debug); if ($cache) { $wise->setCacheDir($cache); } $locator = new FileLocator($paths); $resolver = new LoaderResolver(array(new Loader\IniFileLoader($locator), new Loader\JsonFileLoader($locator), new Loader\PhpFileLoader($locator), new Loader\XmlFileLoader($locator), new Loader\YamlFileLoader($locator))); $wise->setCollector(new Resource\ResourceCollector()); $wise->setLoader(new DelegatingLoader($resolver)); $resolver->setResourceCollector($wise->getCollector()); $resolver->setWise($wise); return $wise; }