当前位置: 首页>>代码示例>>PHP>>正文


PHP CatalogCategoryView::getTopToolbar方法代码示例

本文整理汇总了PHP中Magento\Catalog\Test\Page\Category\CatalogCategoryView::getTopToolbar方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogCategoryView::getTopToolbar方法的具体用法?PHP CatalogCategoryView::getTopToolbar怎么用?PHP CatalogCategoryView::getTopToolbar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Catalog\Test\Page\Category\CatalogCategoryView的用法示例。


在下文中一共展示了CatalogCategoryView::getTopToolbar方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: verifyDisplaySettings

 /**
  * Verify category Display Settings data:
  * # default_sort_by
  * # available_sort_by
  *
  * @param array $categoryData
  * @return array
  */
 protected function verifyDisplaySettings(array $categoryData)
 {
     $errorMessage = [];
     //TODO: verify display_mode
     if (isset($categoryData['default_sort_by'])) {
         $sortBy = strtolower($categoryData['default_sort_by']);
         $sortType = $this->categoryViewPage->getTopToolbar()->getSelectSortType();
         if ($sortBy != $sortType) {
             $errorMessage[] = '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) {
             $expected = array_values($availableSortType);
             $actual = $this->categoryViewPage->getTopToolbar()->getSortType();
             if ($expected != $actual) {
                 $errorMessage[] = 'Wrong available sorting type.' . "\nExpected: " . implode(PHP_EOL, $expected) . "\nActual: " . implode(PHP_EOL, $actual);
             }
         }
     }
     // TODO: verify Layered Navigation Price Step
     return $errorMessage;
 }
开发者ID:uibar,项目名称:lavinia2,代码行数:34,代码来源: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


注:本文中的Magento\Catalog\Test\Page\Category\CatalogCategoryView::getTopToolbar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。