/** * Select store view for order based on Order fixture. * * @param StoreFixture|null $store * @return void */ public function selectStoreView(StoreFixture $store = null) { if (!$this->isVisible()) { return; } $storeName = $store == null ? 'Default Store View' : $store->getName(); $selector = sprintf($this->storeLabel, $storeName); $this->_rootElement->find($selector, Locator::SELECTOR_XPATH, 'checkbox')->setValue('Yes'); $this->getTemplateBlock()->waitLoader(); }
/** * Assert that product is present on custom website. * * @param FixtureFactory $fixtureFactory * @param CatalogProductView $catalogProductView * @param Store $storeView * @param Browser $browser * @return void */ public function processAssert(FixtureFactory $fixtureFactory, CatalogProductView $catalogProductView, Store $storeView, Browser $browser) { /** @var StoreGroup $store */ $store = $storeView->getDataFieldConfig('group_id')['source']->getStoreGroup(); $this->website = $store->getDataFieldConfig('website_id')['source']->getWebsite(); $this->setupPaths(); $this->createWebsiteFolder(); $this->placeFiles(); $this->enableWebsiteConfiguration($fixtureFactory); $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['website_ids' => ['websites' => [$this->website]]]]); $product->persist(); $code = $this->website->getCode(); $productUrl = $_ENV['app_frontend_url'] . "websites/{$code}/" . $product->getUrlKey() . ".html"; $browser->open(str_replace("index.php/", "", $productUrl)); \PHPUnit_Framework_Assert::assertTrue($catalogProductView->getViewBlock()->isVisible(), "Searched product is not visible."); }
/** * Delete store. * * @return void */ public function tearDown() { $this->objectManager->create('Mage\\Core\\Test\\TestStep\\SetupConfigurationStep', ['configData' => 'store_view_local', 'rollback' => true])->run(); $this->storeIndex->open(); if ($this->store->getGroupId() === 'Main Website/Main Website Store') { $this->storeIndex->getStoreGrid()->openStore($this->store); $this->editStore->getFormPageActions()->delete(); $this->deleteStore->getFormPageActions()->delete(); } else { $this->storeIndex->getStoreGrid()->openStoreGroup(explode('/', $this->store->getGroupId())[1]); $this->editGroup->getFormPageActions()->delete(); $this->deleteGroup->getFormPageActions()->delete(); } }
/** * Check is Store View Visible. * * @param Store $store * @return bool */ public function isStoreViewVisible(Store $store) { $availableStores = explode("\n", $this->_rootElement->find($this->storeSwitcher)->getText()); return in_array(strtoupper($store->getName()), $availableStores); }
/** * Set config. * * @param Store $store * @param FixtureFactory $fixtureFactory * @param ConfigData $config * @return void */ protected function setConfig(Store $store, FixtureFactory $fixtureFactory, ConfigData $config) { $configData = $config->getData(); $configData['section']['general/locale/code']['scope'] .= '/' . $store->getCode(); $fixtureFactory->createByCode('configData', ['data' => $configData['section']])->persist(); }
/** * Persist store view with created store. * * @param Store $storeView * @param StoreGroup $store * @return Store */ protected function persistStoreView(Store $storeView, StoreGroup $store) { $data = ['data' => array_merge($storeView->getData(), ['group_id' => ['store_group' => $store]])]; $storeView = $this->fixtureFactory->createByCode('store', $data); $storeView->persist(); return $storeView; }
/** * Assert that created Store View can be found in Stores grid by name. * * @param StoreIndex $storeIndex * @param Store $store * @return void */ public function processAssert(StoreIndex $storeIndex, Store $store) { $storeName = $store->getName(); $storeIndex->open(); \PHPUnit_Framework_Assert::assertTrue($storeIndex->getStoreGrid()->isStoreExists($storeName), "Store {$storeName} is not present in grid."); }
/** * Check if store visible in scope dropdown. * * @param Store $store * @return bool */ public function isStoreVisible($store) { return $this->_rootElement->find(sprintf($this->storeViewSelector, $store->getCode()))->isVisible(); }
/** * Select store group. * * @param Store $store * @return void */ public function selectStoreGroup(Store $store) { $storeGroupName = explode("/", $store->getGroupId())[1]; $this->_rootElement->find($this->storeGroupSwitch, Locator::SELECTOR_CSS, 'select')->setValue($storeGroupName); }
/** * Open Store View. * * @param Store $store * @return void */ public function openStore(Store $store) { $this->_rootElement->find(sprintf($this->storeName, $store->getName()), Locator::SELECTOR_XPATH)->click(); }