public function testContextualized() { Config::readPath(__DIR__ . '/../fixtures/config/contexts'); $config = array('default' => array('app.debug' => false, 'app.caching' => array('driver' => 'redis', 'host' => 'redis.mytestserver.tld'), 'app' => array('debug' => false, 'caching' => array('driver' => 'redis', 'host' => 'redis.mytestserver.tld')), 'db.datastore' => 'mysql', 'db.host' => 'localhost', 'db.user' => 'root', 'db.password' => 'root', 'db.name' => 'production', 'db' => array('datastore' => 'mysql', 'host' => 'localhost', 'user' => 'root', 'password' => 'root', 'name' => 'production')), 'production' => array('app.debug' => false, 'app.caching' => array('driver' => 'redis', 'host' => 'redis.mytestserver.tld'), 'app' => array('debug' => false, 'caching' => array('driver' => 'redis', 'host' => 'redis.mytestserver.tld')), 'db.datastore' => 'mysql', 'db.host' => 'localhost', 'db.user' => 'root', 'db.password' => 'root', 'db.name' => 'production', 'db' => array('datastore' => 'mysql', 'host' => 'localhost', 'user' => 'root', 'password' => 'root', 'name' => 'production')), 'test' => array('app.debug' => true, 'app.caching' => array('driver' => 'file', 'host' => '/cache/dir'), 'app' => array('debug' => true, 'caching' => array('driver' => 'file', 'host' => '/cache/dir')), 'db.datastore' => 'mysql', 'db.host' => 'localhost', 'db.user' => 'root', 'db.password' => null, 'db.name' => 'test', 'db' => array('datastore' => 'mysql', 'host' => 'localhost', 'user' => 'root', 'password' => null, 'name' => 'test'))); $this->runArrayAssertions($config['default']); $this->assertEquals(array('datastore' => 'mysql', 'host' => 'localhost', 'user' => 'root', 'password' => 'root', 'name' => 'production'), Config::get('db')); Config::setContext('test'); $this->runArrayAssertions($config['test']); $this->assertEquals(array('datastore' => 'mysql', 'host' => 'localhost', 'user' => 'root', 'password' => NULL, 'name' => 'test'), Config::get('db')); Config::setContext('production'); $this->runArrayAssertions($config['production']); }