Beispiel #1
0
 /**
  * @expectedException  \RuntimeException
  * @group Common
  */
 public function testReadOnly()
 {
     $c = new DataContainer(array('some' => array('data' => true)));
     $this->assertTrue($c->get('some.data'));
     $this->assertFalse($c->isReadOnly());
     $c->set('some.thing', true);
     $c->setReadOnly(true);
     $c->set('some.other.thing', true);
 }
Beispiel #2
0
 /**
  * Sets the original data for this model
  *
  * @param array|DataContainer $data
  *
  * @throws \InvalidArgumentException
  *
  * @since 2.0
  */
 protected function setOriginalData($data)
 {
     if (is_array($data)) {
         $data = new DataContainer($data);
     }
     // Make sure the original data can't be changed
     $data->setReadOnly(true);
     $this->originalData = $data;
 }