/** * {@inheritdoc} */ protected function createCreateForm() { $form = new Form(); $form->setAttribute('method', 'POST'); $form->setAttribute('action', $this->route); $customerFieldset = new Fieldset(); $customerFieldset->setLegend(gettext('Customer details')); $customerFieldset['customerName'] = (new Input\Text('customerName'))->setLabel(gettext('Customer name')); $customerFieldset['customerPhone'] = (new Input\Text('customerPhone'))->setLabel(gettext('Customer phone')); $customerFieldset['customerEmail'] = (new Input\Email('customerEmail'))->setLabel(gettext('Customer email')); $form['customerDetails'] = $customerFieldset; $serviceFieldset = new Fieldset(); $serviceFieldset->setLegend(gettext('Service details')); $serviceFieldset['description'] = (new Input\Textarea('description'))->setLabel(gettext('Description')); $serviceFieldset['estimatedEnd'] = (new Input\Text('estimatedEnd'))->setLabel(gettext('Estimated end')); $form['serviceDetails'] = $serviceFieldset; $form['submit'] = (new Input\Button('submit'))->setAttribute('type', 'submit')->setContents(gettext('Create')); return $form; }
/** * @covers ::render * @group Fieldset */ public function testRenderWithLegend() { $renderer = \Mockery::mock('Fuel\\Fieldset\\Render'); $this->object->setLegend('Test Legend'); $this->assertXmlStringEqualsXmlFile($this->testFileLocations['testRenderWithLegend'], $this->object->render($renderer)); }