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


PHP InjectableFixture::hasData方法代码示例

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


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

示例1: getData

 /**
  * Get data of the tabs.
  *
  * @param InjectableFixture|null $fixture
  * @param Element|null $element
  * @return array
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  */
 public function getData(InjectableFixture $fixture = null, Element $element = null)
 {
     $data = [];
     if (null === $fixture) {
         foreach ($this->tabs as $tabName => $tab) {
             $this->openTab($tabName);
             $tabData = $this->getTabElement($tabName)->getDataFormTab();
             $data = array_merge($data, $tabData);
         }
     } else {
         $tabsFields = $fixture->hasData() ? $this->getFieldsByTabs($fixture) : [];
         $tabsFields['frontend_properties'] = array_merge_recursive($tabsFields['frontend_properties'], $tabsFields['settings']);
         unset($tabsFields['settings']);
         foreach ($tabsFields as $tabName => $fields) {
             $this->openTab($tabName);
             if (isset($fields['widgetOptions'])) {
                 unset($fields['widgetOptions']['value']['type_id']);
                 $fields['widgetOptions'] = $fields['widgetOptions']['value'];
             } elseif (isset($fields['layout'])) {
                 $fields['layout'] = $fields['layout']['value'];
             }
             $tabData = $this->getTabElement($tabName)->getDataFormTab($fields, $this->_rootElement);
             $data = array_merge($data, $tabData);
         }
     }
     $data['type'] = $this->type[$data['type']];
     return $data;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:38,代码来源:WidgetForm.php

示例2: getOptions

 /**
  * Get configurable product options.
  *
  * @param InjectableFixture|null $product [optional]
  * @return array
  * @throws \Exception
  */
 public function getOptions(InjectableFixture $product)
 {
     /** @var ConfigurableProduct $product */
     $attributesData = $product->hasData('configurable_options') ? $product->getConfigurableOptions()['attributes_data'] : [];
     $listOptions = $this->getListOptions();
     $result = [];
     foreach ($attributesData as $option) {
         $title = $option['label'];
         if (!isset($listOptions[$title])) {
             throw new \Exception("Can't find option: \"{$title}\"");
         }
         /** @var Element $optionElement */
         $optionElement = $listOptions[$title];
         $type = $option['frontend_input'];
         $option['frontend_input'] = explode('/', $option['frontend_input'])[1];
         $typeMethod = preg_replace('/[^a-zA-Z]/', '', $option['frontend_input']);
         $getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
         $optionData = $this->{$getTypeData}($optionElement);
         $optionData['title'] = $title;
         $optionData['type'] = $type;
         $isRequire = $this->_rootElement->find(sprintf($this->required, $title), Locator::SELECTOR_XPATH)->isVisible();
         $optionData['is_require'] = $isRequire ? 'Yes' : 'No';
         $result[$title] = $optionData;
     }
     return $result;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:33,代码来源:ConfigurableOptions.php

示例3: prepareCategory

 /**
  * Preparation of category data.
  *
  * @return void
  */
 protected function prepareCategory()
 {
     if ($this->fixture->hasData('category_ids')) {
         $this->fields['product']['category_ids'] = [];
         foreach ($this->fixture->getDataFieldConfig('category_ids')['source']->getCategories() as $category) {
             $this->fields['product']['category_ids'][] = $category->getId();
         }
     }
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:14,代码来源:Curl.php

示例4: fillDefaultField

 /**
  * Fill default fields.
  *
  * @param InjectableFixture $product
  * @return void
  */
 protected function fillDefaultField(InjectableFixture $product)
 {
     $data = [];
     foreach ($this->defaultFields as $field) {
         if ($product->hasData($field)) {
             $data[$field . '_autogenerate'] = 'No';
         }
     }
     $mapping = $this->dataMapping($data);
     $this->_fill($mapping);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:17,代码来源:QuickCreation.php

示例5: processAssert

 /**
  * Assert that out of stock product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, "Product is absent on category page.");
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:20,代码来源:AssertProductOutOfStockVisibleInCategory.php

示例6: processAssert

 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog).
  *
  * @param InjectableFixture $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttributeOriginal
  * @throws \Exception
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
 {
     if (!$product->hasData('sku')) {
         $product = $this->createProductWithAttributeSet($productAttributeOriginal, $attributeSet);
     }
     $filterProduct = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:24,代码来源:AssertAddedProductAttributeOnProductForm.php

示例7: __construct

 /**
  * @constructor
  * @param FixtureFactory $fixtureFactory
  * @param array $params
  * @param array $data
  */
 public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
 {
     $this->params = $params;
     $explodeValue = explode('::', $data['value']);
     if (!empty($explodeValue) && count($explodeValue) > 1) {
         $fixtureCode = $explodeValue[0];
         $dataSet = isset($explodeValue[2]) ? $explodeValue[1] : '';
         $searchValue = isset($explodeValue[2]) ? $explodeValue[2] : $explodeValue[1];
         $this->product = $fixtureFactory->createByCode($fixtureCode, ['dataSet' => $dataSet]);
         if (!$this->product->hasData('id')) {
             $this->product->persist();
         }
         if ($this->product->hasData($searchValue)) {
             $getProperty = 'get' . str_replace(' ', '', ucwords(str_replace('_', ' ', $searchValue)));
             $this->data = $this->product->{$getProperty}();
         } else {
             $this->data = $searchValue;
         }
     } else {
         $this->data = strval($data['value']);
     }
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:28,代码来源:QueryText.php

示例8: prepareFpt

 /**
  * Preparation of fpt attribute data.
  *
  * @return void
  */
 protected function prepareFpt()
 {
     if ($this->fixture->hasData('fpt')) {
         $fptLabel = $this->fixture->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()->getDataFieldConfig('assigned_attributes')['source']->getAttributes()[0]->getFrontendLabel();
         $fptValues = $this->fields['product'][$fptLabel];
         foreach ($fptValues as $key => $item) {
             $item['value'] = $item['price'];
             unset($item['price']);
             $fptValues[$key] = $item;
         }
         $this->fields['product']['custom_attributes'][] = ['attribute_code' => $fptLabel, 'value' => $fptValues];
         unset($this->fields['product'][$fptLabel]);
     }
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:19,代码来源:Webapi.php

示例9: processAssert

 /**
  * Assert that product is visible in the assigned category.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
 {
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     if ($product->getVisibility() === 'Search' || $this->getStockStatus($product) === 'Out of Stock') {
         $isProductVisible = !$isProductVisible;
         $this->errorMessage = 'Product found in this category.';
         $this->successfulMessage = 'Asserts that the product could not be found in this category.';
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, $this->errorMessage);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:27,代码来源:AssertProductVisibleInCategory.php

示例10: verifyPrice

 /**
  * Verify displayed product price on product page(front-end) equals passed from fixture.
  *
  * @return string|null
  */
 protected function verifyPrice()
 {
     if ($this->product->hasData('price') == false) {
         return null;
     }
     $fixtureProductPrice = number_format($this->product->getPrice(), 2);
     $formProductPrice = $this->productView->getPriceBlock()->getRegularPrice();
     if ($fixtureProductPrice == $formProductPrice) {
         return null;
     }
     $error = "Displayed product price on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductPrice}, expected: {$fixtureProductPrice}.";
     $verifySpecialPriceResult = $this->verifySpecialPrice();
     if ($verifySpecialPriceResult !== null) {
         $error .= $verifySpecialPriceResult;
     }
     return $error;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:22,代码来源:AssertProductPage.php

示例11: processAssert

 /**
  * Add this attribute to Default attribute Template. Create product and Assert that created attribute
  * is displayed on product form (Products > Inventory > Catalog).
  *
  * @param InjectableFixture $product
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttributeOriginal
  * @throws \Exception
  * @return void
  */
 public function processAssert(InjectableFixture $product, FixtureFactory $fixtureFactory, CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttributeOriginal = null)
 {
     $this->fixtureFactory = $fixtureFactory;
     $this->catalogProductIndex = $catalogProductIndex;
     $this->catalogProductEdit = $catalogProductEdit;
     if (!$product->hasData('sku')) {
         if (!$productAttributeOriginal) {
             $productAttributeOriginal = $attribute;
         }
         $product = $this->objectManager->create('Magento\\Catalog\\Test\\TestStep\\CreateProductWithAttributeSetStep', ['attribute' => $productAttributeOriginal, 'attributeSet' => $attributeSet])->run();
         $product = $product['product'];
     }
     $filterProduct = ['sku' => $product->getSku()];
     $catalogProductIndex->open();
     $catalogProductIndex->getProductGrid()->searchAndOpen($filterProduct);
     $catalogProductAttribute = $productAttributeOriginal !== null ? array_merge($productAttributeOriginal->getData(), $attribute->getData()) : $attribute->getData();
     \PHPUnit_Framework_Assert::assertTrue($catalogProductEdit->getProductForm()->checkAttributeLabel($catalogProductAttribute), "Product Attribute is absent on Product form.");
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:32,代码来源:AssertAddedProductAttributeOnProductForm.php

示例12: processAssert

 /**
  * Checking the product in the page of its price.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param CatalogCategory $category
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category)
 {
     // Open category view page and check visible product
     $categoryName = $category->getName();
     if ($product->hasData('category_ids')) {
         $categoryIds = $product->getCategoryIds();
         $categoryName = is_array($categoryIds) ? reset($categoryIds) : $categoryName;
     }
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
         $isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     \PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.');
     //Process price asserts
     $this->assertPrice($product, $catalogCategoryView);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:27,代码来源:AssertProductInCategory.php

示例13: verifySearchResult

 /**
  * Process assert search result.
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @param string $param
  * @throws \Exception
  * @return void
  *
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function verifySearchResult(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, InjectableFixture $product, $param)
 {
     $cmsIndex->open();
     $searchValue = $product->hasData($param) !== false ? $product->getData($param) : null;
     if ($searchValue === null) {
         throw new \Exception("Product '{$product->getName}()' doesn't have '{$param}' parameter.");
     }
     $param = strtoupper($param);
     $this->errorMessage = sprintf($this->formatForErrorMessage, $param);
     $this->successfulMessage = sprintf($this->formatForSuccessfulMessage, $param);
     $cmsIndex->getSearchBlock()->search($searchValue);
     $quantityAndStockStatus = $product->getStockData();
     $stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
     $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
     while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
         $isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product);
     }
     if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') {
         $isVisible = !$isVisible;
         list($this->errorMessage, $this->successfulMessage) = [$this->successfulMessage, $this->errorMessage];
     }
     \PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:35,代码来源:AssertProductSearchable.php

示例14: getOptions

 /**
  * Get product options.
  *
  * @param InjectableFixture $product
  * @return array
  * @throws \Exception
  */
 public function getOptions(InjectableFixture $product)
 {
     $dataOptions = $product->hasData('custom_options') ? $product->getCustomOptions() : [];
     if (empty($dataOptions)) {
         return $dataOptions;
     }
     $listCustomOptions = $this->getListOptions();
     $result = [];
     foreach ($dataOptions as $option) {
         $title = $option['title'];
         if (!isset($listCustomOptions[$title])) {
             throw new \Exception("Can't find option: \"{$title}\"");
         }
         /** @var Element $optionElement */
         $optionElement = $listCustomOptions[$title];
         $option['type'] = explode('/', $option['type'])[1];
         $typeMethod = preg_replace('/[^a-zA-Z]/', '', $option['type']);
         $getTypeData = 'get' . ucfirst(strtolower($typeMethod)) . 'Data';
         $optionData = $this->{$getTypeData}($optionElement);
         $optionData['title'] = $title;
         $optionData['type'] = $option['type'];
         $optionData['is_require'] = $optionElement['title']->find($this->required, Locator::SELECTOR_XPATH)->isVisible() ? 'Yes' : 'No';
         $result[$title] = $optionData;
     }
     return ['custom_options' => $result];
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:33,代码来源:CustomOptions.php

示例15: prepareCategories

 /**
  * Prepare categories for fill.
  *
  * @param InjectableFixture $product
  * @param CatalogCategory|null $category
  * @return array
  */
 protected function prepareCategories(InjectableFixture $product, CatalogCategory $category = null)
 {
     return $category ? [$category] : ($product->hasData('category_ids') ? $product->getDataFieldConfig('category_ids')['source']->getCategories() : []);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:ProductForm.php


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