Example #1
0
 public function testGetAdminExtensionsRouteYaml()
 {
     $structure = ['Menu' => ['router.yml' => '', 'conf.yml' => ''], 'Post' => ['router.yml' => '', 'conf.yml' => ''], 'Page' => ['conf.yml' => '']];
     $this->_adminExtension = new AdminExtension(MockTest::mockFileSystem($structure));
     MockTest::inject($this->_adminExtension, 'extensionsArray', ['Menu', 'Page', 'Post']);
     $this->assertEquals(['vfs://mock/Menu/router.yml', 'vfs://mock/Post/router.yml'], $this->_adminExtension->getAdminExtensionsRouteYaml());
 }
Example #2
0
 /**
  * Configures and loads http
  * @link https://github.com/ignaszak/php-router
  */
 public function loadHttp()
 {
     $yaml = new RouterYaml();
     $yaml->add($this->routerYaml);
     $adminYaml = $this->adminExtension->getAdminExtensionsRouteYaml();
     foreach ($adminYaml as $file) {
         $yaml->add($file);
     }
     $cache = new Cache($yaml);
     $cache->tmpDir = $this->dir($this->conf['conf']['tmp']['router'] ?? '');
     $matcher = new Matcher($cache);
     $host = new Host(RegistryFactory::start('file')->register('Conf\\Conf')->getRequestUri());
     $response = new Response($matcher->match($host));
     $this->registry->set('url', new UrlGenerator($cache, $host));
     $this->http = new Http($response, Request::createFromGlobals());
     $this->registry->set('http', $this->http);
 }