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


PHP CatalogCategoryView::getTitleBlock方法代碼示例

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


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

示例1: processAssert

 /**
  * Assert that category name is different on different store view.
  *
  * @param BrowserInterface $browser
  * @param CatalogCategoryView $categoryView
  * @param Category $category
  * @param Category $initialCategory
  * @param CmsIndex $cmsIndex
  * @return void
  */
 public function processAssert(BrowserInterface $browser, CatalogCategoryView $categoryView, Category $category, Category $initialCategory, CmsIndex $cmsIndex)
 {
     $cmsIndex->open();
     $cmsIndex->getLinksBlock()->waitWelcomeMessage();
     $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($initialCategory->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for default store.');
     $store = $category->getDataFieldConfig('store_id')['source']->store->getName();
     $cmsIndex->getStoreSwitcherBlock()->selectStoreView($store);
     $cmsIndex->getLinksBlock()->waitWelcomeMessage();
     $browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($category->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong category name is displayed for ' . $store);
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:22,代碼來源:AssertCategoryWithCustomStoreOnFrontend.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: processAssert

 /**
  * Assert that the category is no longer available on the top menu bar
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategory $category
  * @param Browser $browser
  * @param CatalogCategoryView $categoryView
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategory $category, Browser $browser, CatalogCategoryView $categoryView)
 {
     $cmsIndex->open();
     \PHPUnit_Framework_Assert::assertFalse($cmsIndex->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
     $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals($category->getName(), $categoryView->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
     if (isset($category->getDataFieldConfig('category_products')['source'])) {
         $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
         foreach ($products as $productFixture) {
             \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture->getName()), "Products '{$productFixture->getName()}' not find.");
         }
     }
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:22,代碼來源:AssertCategoryIsNotIncludeInMenu.php

示例4: assertGeneralInformation

 /**
  * Assert category general information
  *
  * @param Category $category
  * @param array $categoryData
  * @return void
  */
 protected function assertGeneralInformation(Category $category, array $categoryData)
 {
     $categoryUrl = $this->getCategoryUrl($category);
     \PHPUnit_Framework_Assert::assertEquals($categoryUrl, $this->browser->getUrl(), 'Wrong page URL.' . "\nExpected: " . $categoryUrl . "\nActual: " . $this->browser->getUrl());
     if (isset($categoryData['name'])) {
         $title = $this->categoryViewPage->getTitleBlock()->getTitle();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['name'], $title, 'Wrong page title.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title);
     }
     if (isset($categoryData['description'])) {
         $description = $this->categoryViewPage->getViewBlock()->getDescription();
         \PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $description, 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description);
     }
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:20,代碼來源:AssertCategoryPage.php

示例5: processAssert

 /**
  * Assert that created widget displayed on frontend on Home page and on Advanced Search and
  * after click on widget link on frontend system redirects you to catalog page.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $categoryView
  * @param Widget $widget
  * @param AdminCache $adminCache
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $categoryView, Widget $widget, AdminCache $adminCache)
 {
     // Flush cache
     $adminCache->open();
     $adminCache->getActionsBlock()->flushMagentoCache();
     $adminCache->getMessagesBlock()->waitSuccessMessage();
     $cmsIndex->open();
     $widgetText = $widget->getParameters()['anchor_text'];
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText), 'Widget with type catalog category link is absent on Home page.');
     $cmsIndex->getWidgetView()->clickToWidget($widget, $widgetText);
     $title = $categoryView->getTitleBlock()->getTitle();
     \PHPUnit_Framework_Assert::assertEquals($widget->getParameters()['entities'][0]->getName(), $title, 'Wrong category title.');
     $cmsIndex->getFooterBlock()->openAdvancedSearch();
     \PHPUnit_Framework_Assert::assertTrue($cmsIndex->getWidgetView()->isWidgetVisible($widget, $widgetText), 'Widget with type catalog category link is absent on Advanced Search page.');
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:25,代碼來源:AssertWidgetCatalogCategoryLink.php

示例6: verifyGeneralInformation

 /**
  * Verify category general information:
  * # Include in menu
  * # Name
  *
  * @param array $categoryData
  * @return array
  */
 protected function verifyGeneralInformation(array $categoryData)
 {
     $errorMessage = [];
     if (isset($categoryData['include_in_menu']) && $categoryData['include_in_menu'] == 'Yes') {
         if (!$this->categoryViewPage->getTopmenu()->isCategoryVisible($categoryData['name'])) {
             $errorMessage[] = 'Category is not visible in the navigation pane.';
         }
     }
     if (isset($categoryData['include_in_menu']) && $categoryData['include_in_menu'] == 'No') {
         if ($this->categoryViewPage->getTopmenu()->isCategoryVisible($categoryData['name'])) {
             $errorMessage[] = 'Category is visible in the navigation pane.';
         }
     }
     if (isset($categoryData['name'])) {
         $title = $this->categoryViewPage->getTitleBlock()->getTitle();
         if ($categoryData['name'] != $title) {
             $errorMessage[] = 'Wrong category name.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title;
         }
     }
     return $errorMessage;
 }
開發者ID:uibar,項目名稱:lavinia2,代碼行數:29,代碼來源:AssertCategoryPage.php

示例7: processAssert

 /**
  * Assert that not displayed category in frontend main menu
  *
  * @param Browser $browser
  * @param CatalogCategoryView $categoryView
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(Browser $browser, CatalogCategoryView $categoryView, CatalogCategory $category)
 {
     $browser->open($_ENV['app_frontend_url'] . $category->getUrlKey() . '.html');
     \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $categoryView->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:13,代碼來源:AssertCategoryAbsenceOnFrontend.php

示例8: processAssert

 /**
  * Assert that the category cannot be accessed using the direct URL and from the navigation bar in the frontend
  *
  * @param Category $category
  * @param CatalogCategoryView $categoryView
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(Category $category, CatalogCategoryView $categoryView, BrowserInterface $browser)
 {
     $browser->open($this->getCategoryUrl($category));
     \PHPUnit_Framework_Assert::assertFalse($categoryView->getTopmenu()->isCategoryVisible($category->getName()), 'Category can be accessed from the navigation bar in the frontend.');
     \PHPUnit_Framework_Assert::assertEquals(self::NOT_FOUND_MESSAGE, $categoryView->getTitleBlock()->getTitle(), 'Wrong page is displayed.');
 }
開發者ID:uibar,項目名稱:lavinia2,代碼行數:14,代碼來源:AssertCategoryIsNotActive.php


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