示例#1
0
 public function testGetDefaultEnvironmentMethod()
 {
     $path = __DIR__ . '/_files';
     // test with the config array
     $configArray = $this->getConfigArray();
     $config = new \Phinx\Config\Config($configArray);
     $this->assertEquals('testing', $config->getDefaultEnvironment());
     // test using a Yaml file without the 'default_database' key.
     // (it should default to the first one).
     $config = \Phinx\Config\Config::fromYaml($path . '/no_default_database_key.yml');
     $this->assertEquals('production', $config->getDefaultEnvironment());
 }
 public function testGetDefaultEnvironmentMethod()
 {
     $path = __DIR__ . '/_files';
     // test with the config array
     $configArray = $this->getConfigArray();
     $config = new \Phinx\Config\Config($configArray);
     $this->assertEquals('testing', $config->getDefaultEnvironment());
     // test using a Yaml file without the 'default_database' key.
     // (it should default to the first one).
     $config = \Phinx\Config\Config::fromYaml($path . '/no_default_database_key.yml');
     $this->assertEquals('production', $config->getDefaultEnvironment());
     // test using environment variable PHINX_ENVIRONMENT
     // (it should return the configuration specified in the environment)
     putenv('PHINX_ENVIRONMENT=externally-specified-environment');
     $config = \Phinx\Config\Config::fromYaml($path . '/no_default_database_key.yml');
     $this->assertEquals('externally-specified-environment', $config->getDefaultEnvironment());
     putenv('PHINX_ENVIRONMENT=');
 }