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


PHP Category::hasData方法代码示例

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


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

示例1: __construct

 /**
  * @constructor
  * @param FixtureFactory $fixtureFactory
  * @param array $params
  * @param array|int $data
  */
 public function __construct(FixtureFactory $fixtureFactory, array $params, $data = [])
 {
     $this->params = $params;
     if (isset($data['dataSet']) && $data['dataSet'] !== '-') {
         $this->parentCategory = $fixtureFactory->createByCode('category', ['dataSet' => $data['dataSet']]);
         if (!$this->parentCategory->hasData('id')) {
             $this->parentCategory->persist();
         }
         $this->data = $this->parentCategory->getId();
     } else {
         $this->data = $data;
     }
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:ParentId.php

示例2: selectCategory

 /**
  * Select category by its name.
  *
  * @param Category|null $category
  * @return void
  */
 public function selectCategory($category)
 {
     if ($category != null && $category->hasData('name')) {
         $this->_rootElement->find("//a[contains(text(),'{$category->getName()}')]", Locator::SELECTOR_XPATH)->click();
     } else {
         $this->skipCategorySelection();
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:14,代码来源:Tree.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: getCategoryUrl

 /**
  * Get category url to open.
  *
  * @param Category $category
  * @return string
  */
 protected function getCategoryUrl(Category $category)
 {
     $categoryUrlKey = [];
     while ($category) {
         $categoryUrlKey[] = $category->hasData('url_key') ? strtolower($category->getUrlKey()) : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
         $category = $category->getDataFieldConfig('parent_id')['source']->getParentCategory();
         if (1 == $category->getParentId()) {
             $category = null;
         }
     }
     return $_ENV['app_frontend_url'] . implode('/', array_reverse($categoryUrlKey)) . '.html';
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:18,代码来源:AssertCategoryPage.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: 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

示例8: getCategoryUrl

 /**
  * Get category url to open
  *
  * @param Category $category
  * @return string
  */
 protected function getCategoryUrl(Category $category)
 {
     $categoryUrlKey = $category->hasData('url_key') ? strtolower($category->getUrlKey()) : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
     return $_ENV['app_frontend_url'] . $categoryUrlKey . '.html';
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:11,代码来源:AssertCategoryPage.php


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