示例#1
0
 /**
  * Fill store.
  *
  * @param UrlRewrite $urlRewrite
  * @return void
  */
 protected function fillStore(UrlRewrite $urlRewrite)
 {
     $storeField = $this->_rootElement->find($this->store, Locator::SELECTOR_CSS, 'selectstore');
     if ($storeField->isVisible() && !$urlRewrite->hasData('store_id')) {
         $storeField->setValue('Main Website/Main Website Store/Default Store View');
     }
 }
 /**
  * Assert that product available by new URL on the frontend.
  *
  * @param Browser $browser
  * @param UrlRewrite $urlRewrite
  * @param CatalogProductSimple $product
  * @param CatalogProductView $catalogProductView
  * @param CmsIndex $cmsIndex
  * @param Cache $cachePage
  * @return void
  */
 public function processAssert(Browser $browser, UrlRewrite $urlRewrite, CatalogProductSimple $product, CatalogProductView $catalogProductView, CmsIndex $cmsIndex, Cache $cachePage)
 {
     $cachePage->open()->getPageActions()->flushCacheStorage();
     if ($urlRewrite->hasData('store_id')) {
         $storePath = explode('/', $urlRewrite->getStoreId());
         $cmsIndex->open();
         $cmsIndex->getHeaderBlock()->selectStore($storePath[2]);
     }
     $browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
     \PHPUnit_Framework_Assert::assertEquals($catalogProductView->getViewBlock()->getProductName(), strtoupper($product->getName()), 'URL rewrite product redirect false.');
 }
 /**
  * Delete store.
  *
  * @return void
  */
 public function tearDown()
 {
     if ($this->urlRewrite !== null && $this->urlRewrite->hasData('store_id')) {
         $store = $this->urlRewrite->getDataFieldConfig('store_id')['source']->getStore();
         if ($store->getName() !== 'Default Store View') {
             $this->storeIndex->open();
             $this->storeIndex->getStoreGrid()->openStore($store);
             $this->editStore->getFormPageActions()->delete();
             $this->deleteStore->getFormPageActions()->delete();
         }
         $this->urlRewrite = null;
     }
 }