/** * Adds an option tag to a selection field. * @param SimpleOptionTag $tag New option. * @access public */ function addTag($tag) { if ($tag->getTagName() == 'option') { $this->options[] =& $tag; } }
public function testFailToSetIllegalOptionsInMultiple() { $tag = new MultipleSelectionTag(array('name' => 'a', 'multiple' => '')); $a = new SimpleOptionTag(array('selected' => '')); $a->addContent('AAA'); $tag->addTag($a); $b = new SimpleOptionTag(array()); $b->addContent('BBB'); $tag->addTag($b); $this->assertFalse($tag->setValue(array('CCC'))); $this->assertTrue($tag->setValue(array('AAA', 'BBB'))); $this->assertFalse($tag->setValue(array('AAA', 'CCC'))); }