public function testHandleRequest() { $checkbox = new Checkbox(); $checkbox->setName('test'); $checkbox->handle(new FormData('post', ['test' => 1])); $this->assertTrue($checkbox->isChecked()); $checkbox->handle(new FormData('post', [])); $this->assertFalse($checkbox->isChecked()); }
/** * ``` * $form->checkbox('subscribe', 'Підписка на новини'); * ``` * @param string $name * @param string|null $label * @return Checkbox */ public function checkbox($name, $label = null) { $checkbox = new Checkbox(); $checkbox->setName($name); $checkbox->setLabel($label); $this->addElement($checkbox); return $checkbox; }