Beispiel #1
0
 public function testInit()
 {
     $this->assertEquals('fooEnv', $this->serverContext->getEnvironment());
     $this->assertEquals('fooApp', $this->serverContext->getApplication());
     $this->assertEquals($this->rootPath . '/src', $this->serverContext->getPath(ServerContext::DIR_SRC));
     $this->assertEquals($this->rootPath . '/action', $this->serverContext->getPath(ServerContext::DIR_ACTIONS));
     $this->assertEquals($this->rootPath . '/config', $this->serverContext->getPath(ServerContext::DIR_CONFIG));
     $this->assertEquals($this->rootPath . '/public', $this->serverContext->getPath(ServerContext::DIR_PUBLIC));
 }
Beispiel #2
0
 /**
  * @return ConfigCollection
  * @throws KernelPanicException If configs dir cannot be read
  */
 public function getConfigCollection()
 {
     if (!$this->configCollection) {
         $configDir = $this->serverContext->getPath(ServerContext::DIR_CONFIG);
         if (!is_dir($configDir)) {
             throw new KernelPanicException(sprintf('Config dir does not exists or not readable: %s', $configDir));
         }
         $loader = new YamlFileLoader(new FileLocator([$configDir, $configDir . '/' . $this->serverContext->getEnvironment()]));
         $this->configCollection = new ConfigCollection(new Factory($loader, Config::class));
         $this->configCollection->load(self::CONFIG_SECTION);
     }
     return $this->configCollection;
 }
Beispiel #3
0
 public function testGetEnvironment()
 {
     $this->assertEquals(ServerContext::DEFAULT_ENV, $this->serverContext->getEnvironment());
     $this->serverContext->set('ENV', 'foo');
     $this->assertEquals('foo', $this->serverContext->getEnvironment());
 }