public function setUp() { parent::setUp(); Configure::write('debug', 0); $this->Environment = Environment::getInstance(); $envs = [['name' => 'staging', 'params' => ['SERVER_NAME' => 'example.tld'], 'config' => ['debug' => 2, 'Session.name' => 'staging-session', 'security' => 'low'], 'callable' => null], ['name' => 'production', 'params' => ['SERVER_NAME' => 'production.tld', 'SERVER_ADDR' => '8.8.8.8'], 'config' => ['debug' => 1, 'Session.name' => 'production-session'], 'callable' => null], ['name' => 'preproduction', 'params' => ['SERVER_NAME' => ['preproduction.tld', 'preprod.local']], 'config' => ['debug' => 1, 'Session.name' => 'preproduction-session'], 'callable' => function () { Configure::write('Environment.callback', true); }], ['name' => 'dev1', 'params' => false, 'config' => [], 'callable' => null], ['name' => 'dev2', 'params' => ['is_bool' => 'Hello, World!'], 'config' => [], 'callable' => []]]; foreach ($envs as $env) { Environment::configure($env['name'], $env['params'], $env['config'], $env['callable']); } Configure::read('Environment.setup', false); $_SERVER['CAKE_ENV'] = null; }
/** * Kicks off the environment setup * * @param string $environment Name of the environment we want to force setup for * @param string $default Default environment name * @return bool **/ public static function start($environment = null, $default = 'development') { $_this = Environment::getInstance(); return $_this->setup($environment, $default); }