Exemplo n.º 1
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testOptions()
 {
     $element = new Element('test', array(), array('opt1' => 'value'));
     $this->assertInternalType('null', $element->getOption('opt_unknown'));
     $this->assertEquals('value', $element->getOption('opt1'));
     $this->assertEquals(array('opt1' => 'value'), $element->getOptions());
     $element->setOptions(array('model_link' => array('Model\\TestModel')));
     $this->assertEquals(2, count($element->getModelLink()));
     $element = new Element('test', array(), array('opt1' => 'value'));
     $element->setOption('model_link', array('Model\\TestModel'));
     $this->assertEquals(2, count($element->getModelLink()));
     $element = new Element('test', array(), array('opt' => 'value'));
     $this->assertEquals('value', $element->getOption('opt'));
     $this->assertEquals(array('value', 'value2'), $element->addOption('opt', 'value2')->getOption('opt'));
     // Exception
     $element->setOptions(true);
 }