Ejemplo n.º 1
0
 /**
  *    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;
     }
 }
Ejemplo n.º 2
0
 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')));
 }