Exemplo n.º 1
0
 public function testGetInstance()
 {
     $root = vfsStream::setup('Configuration');
     $file = vfsStream::newFile('production.ini');
     $root->addChild($file);
     $file->withContent($this->iniData);
     $factory = new AdapterFactory(vfsStream::url("Configuration/production.ini"));
     $adapter = $factory->getInstance();
     $this->assertInstanceOf("Noa\\ConfigurationManager\\Adapter\\IniFileAdapter", $adapter);
 }
Exemplo n.º 2
0
 /**
  * manager initialisation
  *
  * @return void
  * @throws \Exception
  */
 public function init()
 {
     $this->adapterFactory = $this->inject('\\Noa\\ConfigurationManager\\AdapterFactory');
     $this->config = $this->adapterFactory->getInstance()->getConfiguration();
     if (!isset($this->config["routes"])) {
         throw new \Exception("routes definition in configuration is missing");
     }
     $this->routes = $this->config["routes"];
     if (isset($this->config["session"]["handler"])) {
         $this->sessionHandler = $this->config["session"]["handler"];
     } else {
         $this->sessionHandler = Keys::DEFAULT_SESSION_HANDLER;
     }
     if (isset($this->config['database'])) {
         $this->database = $this->config['database'];
     } else {
         $this->database = false;
     }
 }