public function testIs() { Environment::set('development'); $this->assertTrue(Environment::is('development')); Environment::set('production'); $this->assertTrue(Environment::is('production')); }
/** * Test whether functions in config works */ public function testStartFunctions() { Environment::configure('dev2', array('is_bool' => false), array(), null); Environment::start(null, 'staging'); $this->assertEquals('dev2', Environment::is()); }
/** * @param string $env * @return bool */ public function isEnv($env) { return $this->envObj->is($env); }
/** * Set configuration key * * @param string|array $key Key name or array of keys * @param string $value Value of key * @param string $environment Environment name * @return boolean */ public static function write($key = '', $value = '', $environment = '') { Environment::init(); if (empty($environment)) { $environment = Environment::get(); } if (is_array($key)) { foreach ($key as $k => $v) { Environment::write($k, $v, $value); } return true; } $return = Configure::write('Environment.' . $environment . '.' . $key, $value); if (Environment::is($environment)) { Configure::write($key, $value); } return $return; }