/** * Enable website configuration. * * @param FixtureFactory $fixtureFactory * @return void */ protected function enableWebsiteConfiguration(FixtureFactory $fixtureFactory) { $code = $this->website->getCode(); $scope = "web/website/{$code}/"; $data = [$scope . 'secure/base_link_url' => ['scope' => $scope, 'value' => "{{secure_base_url}}websites/{$code}/"], $scope . 'unsecure/base_link_url' => ['scope' => $scope, 'value' => "{{unsecure_base_url}}websites/{$code}/"]]; $fixture = $fixtureFactory->createByCode('configData', ['data' => $data]); $fixture->persist(); }
/** * Delete Website after test variation. * * @return void */ public function tearDown() { // Delete Website if ($this->website->hasData('website_id')) { $this->storeIndex->open(); $storeGrid = $this->storeIndex->getStoreGrid(); $storeGrid->openWebsite($this->website->getName()); $this->editStore->getFormPageActions()->delete(); $this->deleteStore->getFormPageActions()->delete(); } }
/** * Get website id. * * @param Website $website * @return int * @throws \Exception */ protected function getWebSiteId(Website $website) { //Set pager limit to 2000 in order to find created website by name $url = $_ENV['app_backend_url'] . 'system_store/index/sort/group_title/dir/asc/limit/2000'; $curl = new BackendDecorator(new CurlTransport(), $this->_configuration); $curl->addOption(CURLOPT_HEADER, 1); $curl->write(CurlInterface::POST, $url, '1.0'); $response = $curl->read(); $expectedUrl = '/admin/system_store/editWebsite/website_id/'; preg_match('@.*' . $expectedUrl . '(\\d+).*?' . $website->getName() . '@siu', $response, $matches); if (empty($matches)) { throw new \Exception('Cannot find website id.'); } return intval($matches[1]); }