load() public method

Finds and returns the file if exists
public load ( ) : Fakerino\Configuration\ConfigurationInterface
return Fakerino\Configuration\ConfigurationInterface
Beispiel #1
0
 /**
  * Bootstrap function for Fakerino,
  * setups the global configuration.
  *
  * @param null|array|string $conf
  *
  * @return FakeDataFactory
  */
 public static function create($conf = null)
 {
     self::$defaultConf = new FakerinoConf();
     self::$defaultConf->loadConfiguration();
     if ($conf !== null) {
         $confArray = $conf;
         if (!is_array($conf)) {
             $confTypeFactory = new FileConfigurationLoaderFactory($conf);
             $confParser = $confTypeFactory->load();
             $confArray = $confParser->toArray();
         }
         $conf = $confArray;
     }
     self::$defaultConf = new FakerinoConf($conf);
     self::$defaultConf->loadConfiguration();
     return new FakeDataFactory(self::getDefaultHandler(), new DoctrineLayer(self::getDatabaseConfig()), new TwigTemplate());
 }
 public function testConfNotSupported()
 {
     $this->setExpectedException('Fakerino\\Configuration\\Exception\\ConfNotSupportedException');
     $conf = new FileConfigurationLoaderFactory($this->notSupportedFile, array('ini'));
     $conf->load();
 }