Ejemplo n.º 1
0
 public static function setUpBeforeClass()
 {
     self::$testDataDir = realpath(__DIR__ . '/../data');
     try {
         self::$config = ConfigFactory::make('File', [File::CONFIG_PATH_INDEX => self::$testDataDir, File::HOST_ID_KEY => 'www.example.com']);
     } catch (\Throwable $t) {
     }
 }
Ejemplo n.º 2
0
 /**
  * singelton constructor
  *
  * the $param['type'] is for the factory to create the correct Config
  *
  * @param array $param
  *
  * @return AbstractConfig
  */
 public static function getInstance($param = null)
 {
     if (self::$instance === null) {
         if (isset($param['type'])) {
             $type = $param['type'];
             unset($param['type']);
         } else {
             throw new \LogicException('Config Type was not specified in the param array $param[\'type\']');
         }
         self::$instance = ConfigFactory::make($type, $param);
     }
     // return singelton instance
     return self::$instance;
 }
 /**
  * @test
  *
  * @expectedException \LogicException
  * @expectedExceptionMessage The Config class has to be implemented and accessible ... chilimatic\lib\Config\Adapter\Asfdasfd is not found
  */
 public function catchLogicExceptionClassDoesNotExist()
 {
     ConfigFactory::make('asfdasfd', [File::CONFIG_PATH_INDEX => self::$testDataDir]);
 }