/** * Assert that New Store Group visible on StoreView Form in Store dropdown. * * @param StoreIndex $storeIndex * @param StoreNew $storeNew * @param StoreGroup $storeGroup * @return void */ public function processAssert(StoreIndex $storeIndex, StoreNew $storeNew, StoreGroup $storeGroup) { $storeIndex->open(); $storeGroupName = $storeGroup->getName(); $storeIndex->getGridPageActions()->addStoreView(); \PHPUnit_Framework_Assert::assertTrue($storeNew->getStoreForm()->isStoreVisible($storeGroupName), "Store Group '{$storeGroupName}' is not present on StoreView Form in Store dropdown."); }
/** * Assert that displayed Store Group data on edit page equals passed from fixture. * * @param StoreIndex $storeIndex * @param EditGroup $editGroup * @param StoreGroup $storeGroup * @return void */ public function processAssert(StoreIndex $storeIndex, EditGroup $editGroup, StoreGroup $storeGroup) { $storeIndex->open(); $storeIndex->getStoreGrid()->openStoreGroup($storeGroup->getName()); $formData = $editGroup->getEditFormStoreGroup()->getData(); $fixtureData = $storeGroup->getData(); $errors = $this->verifyData($fixtureData, $formData); \PHPUnit_Framework_Assert::assertEmpty($errors, $errors); }
/** * Prepare data from text to values. * * @param StoreGroup $fixture * @return array */ protected function prepareData(StoreGroup $fixture) { $categoryId = $fixture->getDataFieldConfig('root_category_id')['source']->getCategory()->getId(); $websiteId = $fixture->getDataFieldConfig('website_id')['source']->getWebsite()->getWebsiteId(); $data = ['group' => ['name' => $fixture->getName(), 'root_category_id' => $categoryId, 'website_id' => $websiteId, 'group_id' => $fixture->hasData('group_id') ? $fixture->getGroupId() : ''], 'store_action' => 'add', 'store_type' => 'group']; return $data; }
/** * Assert that created Store Group can be found in Stores grid by name. * * @param StoreIndex $storeIndex * @param StoreGroup $storeGroup * @return void */ public function processAssert(StoreIndex $storeIndex, StoreGroup $storeGroup) { $storeIndex->open(); $storeGroupName = $storeGroup->getName(); \PHPUnit_Framework_Assert::assertTrue($storeIndex->getStoreGrid()->isStoreGroupExists($storeGroupName), "Store group '{$storeGroupName}' is not present in grid."); }
/** * Persist store with created website. * * @param StoreGroup $store * @return StoreGroup */ protected function persistStore(StoreGroup $store) { $category = $store->getDataFieldConfig('root_category_id')['source']->getCategory(); $data = ['website_id' => ['website' => $this->website], 'root_category_id' => ['category' => $category]]; $store = $this->fixtureFactory->createByCode('storeGroup', ['data' => array_merge($store->getData(), $data)]); $store->persist(); return $store; }
/** * Delete store. * * @return void */ public function tearDown() { $this->storeIndex->open(); if ($this->storeGroup->getWebsiteId() !== 'Main Website') { $this->storeIndex->getStoreGrid()->openWebsite($this->storeGroup->getWebsiteId()); $this->editStore->getFormPageActions()->delete(); $this->deleteStore->getFormPageActions()->delete(); } else { $this->storeIndex->getStoreGrid()->openStoreGroupByName($this->storeGroup->getName()); $this->editStore->getFormPageActions()->delete(); $this->deleteStore->getFormPageActions()->delete(); } }