/**
  * Overrides ArrayObject::offsetSet()
  * This method is called when config is changed via
  *
  *     $config->var = 'asd';
  *
  *     // OR
  *
  *     $config['var'] = 'asd';
  *
  * @param string $key   The key of the config item we're changing
  * @param mixed  $value The new array value
  */
 public function offsetSet($key, $value)
 {
     $this->_parent_instance->_write_config($this->_group_name, $key, $value);
     return parent::offsetSet($key, $value);
 }
예제 #2
0
 /**
  * Make sure that _write_config() passes the changed configuration to all 
  * writers in the queue
  *
  * @test
  * @covers Kohana_Config
  */
 public function test_write_config_passes_changed_config_to_all_writers()
 {
     $config = new Kohana_Config();
     $reader1 = $this->getMock('Kohana_Config_Reader');
     $writer1 = $this->getMock('Kohana_Config_Writer', array('write'));
     $writer2 = $this->getMock('Kohana_Config_Writer', array('write'));
     $writer1->expects($this->once())->method('write')->with('some_group', 'key', 'value');
     $writer2->expects($this->once())->method('write')->with('some_group', 'key', 'value');
     $config->attach($reader1)->attach($writer1)->attach($writer2);
     $config->_write_config('some_group', 'key', 'value');
 }