當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CatalogCategoryView::getViewBlock方法代碼示例

本文整理匯總了PHP中Magento\Catalog\Test\Page\Category\CatalogCategoryView::getViewBlock方法的典型用法代碼示例。如果您正苦於以下問題:PHP CatalogCategoryView::getViewBlock方法的具體用法?PHP CatalogCategoryView::getViewBlock怎麽用?PHP CatalogCategoryView::getViewBlock使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Catalog\Test\Page\Category\CatalogCategoryView的用法示例。


在下文中一共展示了CatalogCategoryView::getViewBlock方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: checkRecentlyViewedBlockOnCategory

 /**
  * Check that block Recently Viewed contains product on category page
  *
  * @param CatalogProductSimple $productSimple
  * @param Category $category
  * @return void
  */
 protected function checkRecentlyViewedBlockOnCategory(CatalogProductSimple $productSimple, Category $category)
 {
     $this->cmsIndex->open();
     $this->cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     $products = $this->catalogCategoryView->getViewBlock()->getProductsFromRecentlyViewedBlock();
     \PHPUnit_Framework_Assert::assertTrue(in_array($productSimple->getName(), $products), 'Product' . $productSimple->getName() . ' is absent on Recently Viewed block on Category page.');
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:AssertWidgetRecentlyViewedProducts.php

示例2: processAssert

 /**
  * Assert that displayed category data on category page equals to passed from fixture
  *
  * @param CatalogCategory $category
  * @param CatalogCategory $initialCategory
  * @param FixtureFactory $fixtureFactory
  * @param CatalogCategoryView $categoryView
  * @param Browser $browser
  * @return void
  */
 public function processAssert(CatalogCategory $category, CatalogCategory $initialCategory, FixtureFactory $fixtureFactory, CatalogCategoryView $categoryView, Browser $browser)
 {
     $product = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'default', 'data' => ['category_ids' => ['category' => $initialCategory]]]);
     $categoryData = array_merge($initialCategory->getData(), $category->getData());
     $product->persist();
     $url = $_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html';
     $browser->open($url);
     \PHPUnit_Framework_Assert::assertEquals($url, $browser->getUrl(), 'Wrong page URL.' . "\nExpected: " . $url . "\nActual: " . $browser->getUrl());
     if (isset($categoryData['name'])) {
         $title = $categoryView->getTitleBlock()->getTitle();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['name'], $title, 'Wrong page title.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title);
     }
     if (isset($categoryData['description'])) {
         $description = $categoryView->getViewBlock()->getDescription();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $description, 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description);
     }
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $categoryView->getTopToolbar()->getSelectSortType();
         \PHPUnit_Framework_Assert::assertEquals($sortBy, $sortType, 'Wrong sorting type.' . "\nExpected: " . $sortBy . "\nActual: " . $sortType);
     }
     if (isset($categoryData['available_sort_by'])) {
         $availableSortType = array_filter($categoryData['available_sort_by'], function (&$value) {
             return $value !== '-' && ucfirst($value);
         });
         if ($availableSortType) {
             $availableSortType = array_values($availableSortType);
             $availableSortTypeOnPage = $categoryView->getTopToolbar()->getSortType();
             \PHPUnit_Framework_Assert::assertEquals($availableSortType, $availableSortTypeOnPage, 'Wrong available sorting type.' . "\nExpected: " . implode(PHP_EOL, $availableSortType) . "\nActual: " . implode(PHP_EOL, $availableSortTypeOnPage));
         }
     }
 }
開發者ID:buskamuza,項目名稱:magento2-skeleton,代碼行數:42,代碼來源:AssertCategoryPage.php

示例3: assertDisplaySetting

 /**
  * Assert category display settings
  *
  * @param Category $category
  * @param array $categoryData
  * @return void
  */
 protected function assertDisplaySetting(Category $category, array $categoryData)
 {
     if (isset($categoryData['landing_page']) && isset($categoryData['display_mode']) && in_array($categoryData['display_mode'], $this->visibleCmsBlockMode)) {
         /** @var LandingPage $sourceLandingPage */
         $sourceLandingPage = $category->getDataFieldConfig('landing_page')['source'];
         $fixtureContent = $sourceLandingPage->getCmsBlock()->getContent();
         $pageContent = $this->categoryViewPage->getViewBlock()->getContent();
         \PHPUnit_Framework_Assert::assertEquals($fixtureContent, $pageContent, 'Wrong category landing page content.' . "\nExpected: " . $fixtureContent . "\nActual: " . $pageContent);
     }
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $this->categoryViewPage->getTopToolbar()->getSelectSortType();
         \PHPUnit_Framework_Assert::assertEquals($sortBy, $sortType, 'Wrong sorting type.' . "\nExpected: " . $sortBy . "\nActual: " . $sortType);
     }
     if (isset($categoryData['available_sort_by'])) {
         $availableSortType = array_filter($categoryData['available_sort_by'], function (&$value) {
             return $value !== '-' && ucfirst($value);
         });
         if ($availableSortType) {
             $availableSortType = array_values($availableSortType);
             $availableSortTypeOnPage = $this->categoryViewPage->getTopToolbar()->getSortType();
             \PHPUnit_Framework_Assert::assertEquals($availableSortType, $availableSortTypeOnPage, 'Wrong available sorting type.' . "\nExpected: " . implode(PHP_EOL, $availableSortType) . "\nActual: " . implode(PHP_EOL, $availableSortTypeOnPage));
         }
     }
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:32,代碼來源:AssertCategoryPage.php

示例4: processAssert

 /**
  * Assert that created CMS block displayed on frontend category page (in order to assign block to category:
  * go to category page> Display settings> CMS Block).
  *
  * @param CmsIndex $cmsIndex
  * @param CmsBlock $cmsBlock
  * @param CatalogCategoryView $catalogCategoryView
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CmsBlock $cmsBlock, CatalogCategoryView $catalogCategoryView, FixtureFactory $fixtureFactory)
 {
     $category = $fixtureFactory->createByCode('category', ['dataset' => 'default_subcategory', 'data' => ['display_mode' => 'Static block and products', 'landing_page' => $cmsBlock->getTitle()]]);
     $category->persist();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     $categoryViewContent = $catalogCategoryView->getViewBlock()->getContent();
     \PHPUnit_Framework_Assert::assertEquals($cmsBlock->getContent(), $categoryViewContent, 'Wrong block content on category is displayed.');
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:19,代碼來源:AssertCmsBlockOnCategoryPage.php

示例5: verifyContent

 /**
  * Verify category Content data:
  * # Description
  * # CMS Block content
  *
  * @param array $categoryData
  * @return array
  */
 protected function verifyContent(array $categoryData)
 {
     $errorMessage = [];
     if (isset($categoryData['description'])) {
         $description = $this->categoryViewPage->getViewBlock()->getDescription();
         if ($categoryData['description'] != $description) {
             $errorMessage[] = 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description;
         }
     }
     if (isset($categoryData['landing_page']) && isset($categoryData['display_mode']) && in_array($categoryData['display_mode'], $this->visibleCmsBlockMode)) {
         /** @var LandingPage $sourceLandingPage */
         $sourceLandingPage = $this->category->getDataFieldConfig('landing_page')['source'];
         $fixtureContent = $sourceLandingPage->getCmsBlock()->getContent();
         $pageContent = $this->categoryViewPage->getViewBlock()->getContent();
         if ($fixtureContent != $pageContent) {
             $errorMessage[] = 'Wrong category landing page content.' . "\nExpected: " . $fixtureContent . "\nActual: " . $pageContent;
         }
     }
     return $errorMessage;
 }
開發者ID:uibar,項目名稱:lavinia2,代碼行數:28,代碼來源:AssertCategoryPage.php


注:本文中的Magento\Catalog\Test\Page\Category\CatalogCategoryView::getViewBlock方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。