/** * @param integer $value * @return $this */ protected function setStatus($value) { $status = $this->form->get('field_issue_status[und]'); $status->setValue($value); $this->form->set($status); return $this; }
/** * Go to the previous form page * * @param \Symfony\Component\DomCrawler\Form $form * @return \TYPO3\Flow\Http\Response */ protected function gotoPreviousFormPage(\Symfony\Component\DomCrawler\Form $form) { $previousButton = $this->browser->getCrawler()->filterXPath('//nav[@class="form-navigation"]/*/*[contains(@class, "previous")]/button'); $previousButton->rewind(); $form->set(new InputFormField($previousButton->current())); return $this->browser->submit($form); }
/** * @param Form $form * @param $code * @param $elementId * @return Crawler */ private function addMenuItemForm(Form $form, $code, $elementId) { $ajaxClient = static::createClient(); $ajaxCrawler = $ajaxClient->request('POST', '/admin/core/append-form-field-element', array_merge($form->getPhpValues(), array('code' => $code, 'elementId' => 'page_' . $elementId, 'uniqid' => 'page'))); foreach ($ajaxCrawler->filter('input') as $node) { if ($node->attributes->getNamedItem('type')) { if ($node->attributes->getNamedItem('type')->nodeValue == 'checkbox' || $node->attributes->getNamedItem('type')->nodeValue == 'radio') { $form->set(new ChoiceFormField($node)); continue; } if ($node->attributes->getNamedItem('type') == 'file') { $form->set(new FileFormField($node)); continue; } } $form->set(new InputFormField($node)); } foreach ($ajaxCrawler->filter('select') as $node) { $form->set(new ChoiceFormField($node)); } foreach ($ajaxCrawler->filter('textarea') as $node) { $form->set(new TextareaFormField($node)); } return $ajaxCrawler; }
/** * Fill form for address tests (update test) * * @param Form $form * @return Form */ protected function fillFormForUpdateTest(Form $form) { $formNode = $form->getNode(); $formNode->setAttribute('action', $formNode->getAttribute('action') . '?_widgetContainer=dialog'); $form['orob2b_account_typed_address[types]'] = [AddressType::TYPE_BILLING, AddressType::TYPE_SHIPPING]; $form['orob2b_account_typed_address[defaults][default]'] = [false, AddressType::TYPE_SHIPPING]; $doc = new \DOMDocument("1.0"); $doc->loadHTML('<select name="orob2b_account_typed_address[country]" id="orob2b_account_typed_address_country" ' . 'tabindex="-1" class="select2-offscreen"> ' . '<option value="" selected="selected"></option> ' . '<option value="ZW">Zimbabwe</option> </select>'); $field = new ChoiceFormField($doc->getElementsByTagName('select')->item(0)); $form->set($field); $form['orob2b_account_typed_address[country]'] = 'ZW'; $doc->loadHTML('<select name="orob2b_account_typed_address[region]" id="orob2b_account_typed_address_region" ' . 'tabindex="-1" class="select2-offscreen"> ' . '<option value="" selected="selected"></option> ' . '<option value="ZW-MA">Manicaland</option> </select>'); $field = new ChoiceFormField($doc->getElementsByTagName('select')->item(0)); $form->set($field); $form['orob2b_account_typed_address[region]'] = 'ZW-MA'; return $form; }