Ejemplo n.º 1
0
 public function addOption($name, $value = null)
 {
     $option = new Dropdown_Option($name, $value);
     $option->setForm($this->getForm());
     $this->options[] = $option;
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Add a new option to this dropdown.
  *
  * @param string $name
  * @param string $value
  * @param string $tooltip (optional)
  * @param Object $readonlyLink (optional) in case the dropdown is rendered in
  *        readonly mode, this link will shown. The text for this link will be
  *        set as $name. If not set, the $name will be shown.
  * @return Dropdown
  */
 public function addOption($name, $value = null, $tooltip = null, $readonlyLink = null)
 {
     $option = new Dropdown_Option($name, $value, $readonlyLink);
     if ($tooltip) {
         $option->set("title", $tooltip);
     }
     $option->setForm($this->getForm());
     $this->options[] = $option;
     return $this;
 }
Ejemplo n.º 3
0
 /**
  * @covers Dropdown::addOption
  */
 public function testAddOptionTooltip()
 {
     $name = "napa";
     $value = "valley";
     $tooltip = "choose office";
     $dropDown = $this->drop->addOption($name, $value, $tooltip);
     $actual = $dropDown->getOptions();
     $excepted = new \Dropdown_Option($name, $value);
     $excepted->setTooltip($tooltip);
     $this->assertContainsOnlyInstancesOf("Dropdown_Option", $actual);
     $this->assertEquals($excepted, $actual[0]);
 }
 /**
  * @covers Dropdown_Option::ToString
  */
 public function testToString()
 {
     $actual = $this->object->toString();
     $excepted = 'france';
     $this->assertEquals($excepted, $actual);
 }