/** * Fill the root form * * @param FixtureInterface $fixture * @param Element $element * @return $this|void * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function fill(FixtureInterface $fixture, Element $element = null) { /** @var TaxRule $fixture */ $this->addNewTaxRates($fixture); $this->openAdditionalSettings(); if ($fixture->hasData('tax_customer_class')) { $taxCustomerBlock = $this->_rootElement->find($this->taxCustomerBlock, Locator::SELECTOR_CSS, 'multiselectlist'); $this->addNewTaxClass($fixture->getTaxCustomerClass(), $taxCustomerBlock); } if ($fixture->hasData('tax_product_class')) { $taxProductBlock = $this->_rootElement->find($this->taxProductBlock, Locator::SELECTOR_CSS, 'multiselectlist'); $this->addNewTaxClass($fixture->getTaxProductClass(), $taxProductBlock); } parent::fill($fixture); }
/** * Fill the review form * * @param FixtureInterface $review * @param Element|null $element * @return $this */ public function fill(FixtureInterface $review, Element $element = null) { if ($review instanceof ReviewInjectable) { $this->fillRatings($review); } parent::fill($review, $element); }
/** * Verify that review is equals to data on form * * @param Review $review * @param Form $form * @return bool */ protected function verifyReviewBackendForm(Review $review, Form $form) { $reviewData = []; foreach ($review->getData()['fields'] as $key => $field) { $reviewData[$key] = $field['value']; } $dataDiff = array_diff($reviewData, $form->getData($review)); return empty($dataDiff); }
/** * Custom options mapping * * @param array|null $fields * @param string|null $parent * @return array * * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ protected function dataMapping(array $fields = null, $parent = null) { list($option, $type, $title, $titleOption) = $fields; $isDate = $type == 'Date' || $type == 'Time' || $type == 'Date & Time'; $isChecked = $type == 'Checkbox' || $type == 'Radio Buttons'; $isField = $type == 'Field' || $type == 'Area'; $optionName = strtolower(preg_replace('/[^a-zA-Z]/', '', $type)); $option += parent::dataMapping([$optionName => []]); $selector = [$option[$optionName]['selector']]; if ($isDate) { $value = explode('/', $option['value'][0]); $selector = $this->setDateTypeSelector(count($value), $selector[0]); } elseif ($isChecked) { $selector[0] = str_replace('%option_name%', $titleOption[0], $selector[0]); $value = ['Yes']; } elseif ($isField) { $value = $option['value']; } else { $value = $titleOption; } return ['title' => $title, 'value' => $value, 'selector' => $selector, 'input' => $option[$optionName]['input']]; }