/**
  * locate() should find paths from the include path
  * 
  * @param string[] $paths
  * @dataProvider provideTestLocateFindsIncludePath
  * @see ConfigurationLocator::locate();
  */
 public function testLocateFindsIncludePath($includePath, array $paths)
 {
     set_include_path(get_include_path() . PATH_SEPARATOR . $includePath);
     $locator = new ConfigurationLocator($paths);
     $configuration = $locator->locate();
     $this->assertInstanceOf("malkusch\\bav\\Configuration", $configuration);
     $this->assertEquals("test", $configuration->getTempDirectory());
     restore_include_path();
 }
Beispiel #2
0
 /**
  * locate a configuration or register the default configuration.
  *
  * You may define the file bav/configuration.php. This file should return
  * a Configuration object.
  *
  * @see DefaultConfiguration
  * @throws ConfigurationException
  */
 public static function classConstructor()
 {
     $locator = new ConfigurationLocator(array(__DIR__ . self::BAV_PATH, self::INCLUDE_PATH));
     $configuration = $locator->locate();
     if ($configuration == null) {
         $configuration = new DefaultConfiguration();
     }
     self::setConfiguration($configuration);
 }