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


PHP Category::getDataFieldConfig方法代码示例

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


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

示例1: processAssert

 /**
  * Assert that the category is no longer available on the top menu bar
  *
  * @param CmsIndex $cmsIndex
  * @param Category $category
  * @param BrowserInterface $browser
  * @param CatalogCategoryView $categoryView
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, Category $category, BrowserInterface $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:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:AssertCategoryIsNotIncludeInMenu.php

示例2: addNewCategory

 /**
  * Add new category to product.
  *
  * @param Category $category
  * @return void
  */
 public function addNewCategory(Category $category)
 {
     $data = ['name' => $category->getName(), 'parent_category' => $category->getDataFieldConfig('parent_id')['source']->getParentCategory()->getName()];
     $this->openNewCategoryDialog();
     $this->_fill($this->dataMapping($data));
     $this->_rootElement->find($this->createCategoryButton)->click();
     $this->waitForElementNotVisible($this->createCategoryButton);
 }
开发者ID:kid17,项目名称:magento2,代码行数:14,代码来源:NewCategoryIds.php

示例3: processAssert

 /**
  * Assert that displayed assigned products on category page equals passed from fixture
  *
  * @param Category $category
  * @param CatalogCategoryView $categoryView
  * @param BrowserInterface $browser
  * @return void
  */
 public function processAssert(Category $category, CatalogCategoryView $categoryView, BrowserInterface $browser)
 {
     $categoryUrlKey = $category->hasData('url_key') ? strtolower($category->getUrlKey()) : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
     $products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     $browser->open($_ENV['app_frontend_url'] . $categoryUrlKey . '.html');
     foreach ($products as $productFixture) {
         \PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->getProductItem($productFixture)->isVisible(), "Products '{$productFixture->getName()}' not find.");
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AssertCategoryForAssignedProducts.php

示例4: prepareFullCategoryPath

 /**
  * Prepare category path.
  *
  * @param Category $category
  * @return array
  */
 protected function prepareFullCategoryPath(Category $category)
 {
     $path = [];
     $parentCategory = $category->hasData('parent_id') ? $category->getDataFieldConfig('parent_id')['source']->getParentCategory() : null;
     if ($parentCategory !== null) {
         $path = $this->prepareFullCategoryPath($parentCategory);
     }
     return array_filter(array_merge($path, [$category->getName()]));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:15,代码来源:Categories.php

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

示例6: prepareCategoryProducts

 /**
  * Prepare category products data for curl.
  *
  * @return void
  */
 protected function prepareCategoryProducts()
 {
     $categoryProducts = [];
     $defaultPosition = 0;
     if ($this->fixture->hasData('category_products')) {
         $products = $this->fixture->getDataFieldConfig('category_products')['source']->getProducts();
         foreach ($products as $product) {
             $categoryProducts[$product->getId()] = $defaultPosition;
         }
     }
     $this->fields['category_products'] = json_encode($categoryProducts);
     unset($this->fields['general']['category_products']);
 }
开发者ID:uibar,项目名称:lavinia2,代码行数:18,代码来源:Curl.php

示例7: processAssert

 /**
  * Assertion that filtered product list via layered navigation are displayed correctly.
  *
  * @param Category $category
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param array $layeredNavigation
  * @return void
  */
 public function processAssert(Category $category, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $layeredNavigation)
 {
     $this->products = $category->getDataFieldConfig('category_products')['source']->getProducts();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
     foreach ($layeredNavigation as $filters) {
         foreach ($filters as $filter) {
             $catalogCategoryView->getLayeredNavigationBlock()->applyFilter($filter['title'], $filter['linkPattern']);
             $productNames = $this->getProductNames($filter['products']);
             sort($productNames);
             $pageProductNames = $catalogCategoryView->getListProductBlock()->getProductNames();
             sort($pageProductNames);
             \PHPUnit_Framework_Assert::assertEquals($productNames, $pageProductNames);
         }
         $catalogCategoryView->getLayeredNavigationBlock()->clearAll();
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:26,代码来源:AssertFilterProductList.php

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

示例9: prepareCategory

 /**
  * Prepare Category fixture with the updated data.
  *
  * @param Category $category
  * @param Category $initialCategory
  * @return Category
  */
 protected function prepareCategory(Category $category, Category $initialCategory)
 {
     $parentCategory = $category->hasData('parent_id') ? $category->getDataFieldConfig('parent_id')['source']->getParentCategory() : $initialCategory->getDataFieldConfig('parent_id')['source']->getParentCategory();
     $data = ['data' => array_merge($initialCategory->getData(), $category->getData(), ['parent_id' => ['source' => $parentCategory]])];
     return $this->fixtureFactory->createByCode('category', $data);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:13,代码来源:UpdateCategoryEntityTest.php

示例10: 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\Fixture\Category::getDataFieldConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。