Esempio n. 1
0
 /**
  * @expectedException  \OutOfBoundsException
  * @group Common
  */
 public function testGetSet()
 {
     $c = new DataContainer();
     $data = array('this' => 'here');
     $this->assertEquals(array(), $c->getContents());
     $c->setContents($data);
     $this->assertEquals($data, $c->getContents());
     $p = new DataContainer();
     $p->what = 'where';
     $c->setParent($p);
     $data = array('this' => 'here', 'what' => 'where');
     $this->assertEquals($data, $c->getContents());
     $c->has('what');
     $this->assertEquals('where', $c->what);
     $this->assertTrue($c->delete('what'));
     $this->assertEquals(null, $c->what);
     $c->disableParent();
     $c->set('this', 'new');
     $this->assertEquals('new', $c->get('this'));
     $this->assertEquals('default', $c->get('nothing', 'default'));
     $c['what'] = 'this';
     $this->assertEquals('this', $c['what']);
     $this->assertEquals($c['what'], $c->what);
     $c['exception'];
 }