/** * Test CC directories */ public function testEnvironment_detector() { $original_host = $_SERVER['HTTP_HOST']; $_SERVER['HTTP_HOST'] = 'localhost'; $this->assertEquals('development', \ClanCats::environment_detector(array('local*' => 'development', ':all' => 'testenv'))); $_SERVER['HTTP_HOST'] = 'example.com'; $this->assertEquals('testenv', \ClanCats::environment_detector(array('local*' => 'development', ':all' => 'testenv'))); $this->assertEquals('example_env', \ClanCats::environment_detector(array('local*' => 'development', 'example.com' => 'example_env', ':all' => 'testenv'))); $this->assertEquals('example_env', \ClanCats::environment_detector(array('local*' => 'development', 'example*' => 'example_env', ':all' => 'testenv'))); $this->assertEquals('example_env', \ClanCats::environment_detector(array('local*' => 'development', '*example.com' => 'example_env', ':all' => 'testenv'))); $_SERVER['HTTP_HOST'] = 'www.example.com'; $this->assertEquals('example_env', \ClanCats::environment_detector(array('local*' => 'development', '*example.com' => 'example_env', ':all' => 'testenv'))); }
unset($paths, $directories); /* *--------------------------------------------------------------- * environment setup *--------------------------------------------------------------- * * In CCF 1.0 we used a $_SERVER environment variable to set the * current CCF environment. This works great if you are abel to * change the server conf. But often people dont have access to * the configurations. * So after doing multiple projects came to the * conclusion that the framework itself should detect the * environent using the hostname or other params. */ if (!isset($environment)) { $environment = ClanCats::environment_detector(require CCROOT . 'boot/environment' . EXT); } /* *--------------------------------------------------------------- * wake ccf *--------------------------------------------------------------- * * Lets wake the ccf and pass the environment. */ ClanCats::wake($environment); unset($environment); // at this point ccf has completet its own boot CCProfiler::check("CCF - Boot completed."); /* *--------------------------------------------------------------- * output buffer