/** * Fill the root form * * @param FixtureInterface $fixture * @param SimpleElement|null $element * @return $this */ public function fill(FixtureInterface $fixture, SimpleElement $element = null) { $element = $this->_rootElement->find(sprintf($this->currencyRow, $fixture->getCode()), Locator::SELECTOR_XPATH); $data = $fixture->getData(); unset($data['code']); $mapping = $this->dataMapping($data); $this->_fill($mapping, $element); return $this; }
/** * Post request for creating widget instance. * * @param FixtureInterface $fixture [optional] * @throws \Exception * @return array */ public function persist(FixtureInterface $fixture = null) { $code = $this->mappingData['code'][$fixture->getCode()]; $themeId = $this->getThemeId($fixture->getThemeId()); $data = $this->prepareData($fixture); $url = $_ENV['app_backend_url'] . 'admin/widget_instance/save/code/' . $code . '/theme_id/' . $themeId; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->write($url, $data); $response = $curl->read(); $curl->close(); if (!strpos($response, 'data-ui-id="messages-message-success"')) { throw new \Exception("Widget instance creation by curl handler was not successful! Response: {$response}"); } $id = null; if (preg_match_all('/\\/widget_instance\\/edit\\/instance_id\\/(\\d+)/', $response, $matches)) { $id = $matches[1][count($matches[1]) - 1]; } return ['id' => $id]; }
/** * Fill the root form * * @param FixtureInterface $fixture * @param SimpleElement|null $element * @return $this */ public function fill(FixtureInterface $fixture, SimpleElement $element = null) { $element = $this->_rootElement->find(sprintf($this->currencyRow, $fixture->getCode()), Locator::SELECTOR_XPATH); return parent::fill($fixture, $element); }