Example #1
0
 /**
  * test extend() with environment or not and override or not.
  *
  * @covers ::extend
  * @covers ::setEnvironment
  * @covers ::addYamlFilenameToIgnore
  * @covers ::setSection
  */
 public function testExtend()
 {
     // test config extend with environment
     $config = new Config($this->test_base_dir);
     $config->setEnvironment('test_extend');
     $config->extend();
     $this->assertEquals($config->getAllSections(), array('say' => array('hello' => 'world', 'bonjour' => 'monde', 'hola' => 'mundo'), 'bar' => array('foo' => 'bar', 'php' => '5.4'), 'foo' => array('bar' => 'foo', 'back' => 'bee')), 'test config extend with environment fails');
     // test config extend with environment and with yml filename ignore
     $config = new Config($this->test_base_dir);
     $config->setEnvironment('test_extend');
     $config->addYamlFilenameToIgnore('bar');
     $config->extend();
     $this->assertEquals($config->getAllSections(), array('say' => array('hello' => 'world', 'bonjour' => 'monde', 'hola' => 'mundo'), 'foo' => array('bar' => 'foo', 'back' => 'bee')), 'test config extend with environment and with yml filename ignore fails');
     // prepare test extend with and withtout override
     $config = new Config($this->test_base_dir);
     $config->setEnvironment('test_extend');
     $config->extend();
     // test extend WITHOUT override
     $config->extend(realpath($this->test_base_dir . '/test_override'));
     $this->assertEquals($config->getSection('foo'), array('bar' => null, 'back' => 'bee', 'tic' => 'tac'));
     // test extend WITH override
     $config->extend(realpath($this->test_base_dir . '/test_override'), true);
     $this->assertEquals($config->getSection('foo'), array('bar' => null, 'tic' => 'tac'));
 }