/** * @group ZF-2828 */ public function testCanPopulateCheckboxOptionsFromPostedData() { $form = new Form(array('elements' => array('100_1' => array('MultiCheckbox', array('multiOptions' => array('100_1_1' => 'Agriculture', '100_1_2' => 'Automotive', '100_1_12' => 'Chemical', '100_1_13' => 'Communications'), 'required' => true))))); $data = array('100_1' => array('100_1_1', '100_1_2', '100_1_12', '100_1_13')); $form->populate($data); $html = $form->render($this->getView()); foreach ($form->getElement('100_1')->getMultiOptions() as $key => $value) { if (!preg_match('#(<input[^>]*' . $key . '[^>]*>)#', $html, $m)) { $this->fail('Missing input for a given multi option: ' . $html); } $this->assertContains('checked="checked"', $m[1]); } }
/** * @group ZF-9682 */ public function testCustomLabelDecorator() { $form = new Form(); $form->addElementPrefixPath('My\\Decorator', __DIR__ . '/../TestAsset/decorators/', 'decorator'); $form->addElement($this->element); $element = $form->getElement('foo'); $this->assertInstanceOf('My\\Decorator\\Label', $element->getDecorator('Label')); }