예제 #1
0
 /**
  * Set up the test case
  */
 public function setUp()
 {
     parent::setUp();
     $path = Enlight_TestHelper::Instance()->TestPath('TempFiles');
     $this->adapterTester = new Enlight_Config_Adapter_File(array('configType' => 'ini', 'configDir' => $path));
     $this->configTester = new Enlight_Config('test', array('adapter' => $this->adapterTester, 'section' => 'test'));
     $this->configTester->setAllowModifications()->set('test', true)->setReadOnly();
     $this->configTester->write();
 }
예제 #2
0
 /**
  * Test case
  */
 public function testConfigSetAllowModifications()
 {
     $config = new Enlight_Config(array('test' => array('test' => true)));
     $config->setAllowModifications();
     $config->test->test = false;
     $this->assertFalse($config->test->test);
 }
예제 #3
0
 /**
  * Constructor method
  *
  * @param $name
  * @param Enlight_Config|null $info
  */
 public function __construct($name, $info = null)
 {
     $this->info = new Enlight_Config($this->getInfo(), true);
     if ($info instanceof Enlight_Config) {
         $info->setAllowModifications(true);
         $updateVersion = null;
         $updateSource = null;
         if ($info->get('version') < $this->info->get('version')) {
             $updateVersion = $this->info->get('version');
             $updateSource = $this->info->get('source');
         }
         $this->info->merge($info);
         if ($updateVersion !== null) {
             $this->info->set('updateVersion', $updateVersion);
             $this->info->set('updateSource', $updateSource);
         }
     }
     $this->info->set('capabilities', $this->getCapabilities());
     parent::__construct($name);
 }