/** * */ public function testHandleRequest() { $element = new RadioList(); $element->setName('lang'); $element->setOptions(['ru' => 'Russian', 'ua' => 'Ukrainian']); $element->handle(new FormData('post', ['lang' => 'ru'])); $this->assertEquals('ru', $element->getValue()); $element->handle(new FormData('post', [])); $this->assertEquals('ru', $element->getValue()); $element->handle(new FormData('post', ['lang' => 'pl'])); $this->assertEquals('ru', $element->getValue()); }
/** * @param string $name * @param string $text * @return RadioList */ public function radioList($name, $text = null) { $radio = new RadioList(); $radio->setName($name); $radio->setText($text); $this->addElement($radio); return $radio; }