• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Fixture\CatalogProductAttribute类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: processAssert

 /**
  * Assert that deleted attribute can't be used for Products' Export
  *
  * @param AdminExportIndex $exportIndex
  * @param CatalogProductAttribute $attribute
  * @param ImportExport $export
  * @return void
  */
 public function processAssert(AdminExportIndex $exportIndex, CatalogProductAttribute $attribute, ImportExport $export)
 {
     $exportIndex->open();
     $exportIndex->getExportForm()->fill($export);
     $filter = ['attribute_code' => $attribute->getAttributeCode()];
     \PHPUnit_Framework_Assert::assertFalse($exportIndex->getFilterExport()->isRowVisible($filter), 'Attribute \'' . $attribute->getFrontendLabel() . '\' is present in Filter export grid');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:AssertProductAttributeAbsenceForExport.php


示例2: processAssert

 /**
  * Assert that displayed attribute data on edit page equals passed from fixture.
  *
  * @param CatalogProductAttributeIndex $catalogProductAttributeIndex
  * @param CatalogProductAttributeNew $catalogProductAttributeNew
  * @param CatalogProductAttribute $attribute
  * @throws \Exception
  * @return void
  */
 public function processAssert(CatalogProductAttributeIndex $catalogProductAttributeIndex, CatalogProductAttributeNew $catalogProductAttributeNew, CatalogProductAttribute $attribute)
 {
     $filter = ['attribute_code' => $attribute->getAttributeCode()];
     $catalogProductAttributeIndex->open()->getGrid()->searchAndOpen($filter);
     $errors = $this->verifyData($attribute->getData(), $catalogProductAttributeNew->getAttributeForm()->getData($attribute));
     \PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:AssertAttributeForm.php


示例3: testDeleteSystemProductAttribute

 /**
  * Run delete system product attribute test
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductAttributeIndex $attributeIndex
  * @return void
  */
 public function testDeleteSystemProductAttribute(CatalogProductAttribute $productAttribute, CatalogProductAttributeIndex $attributeIndex)
 {
     $filter = $productAttribute->getData();
     // Steps
     $attributeIndex->open();
     $attributeIndex->getGrid()->searchAndOpen($filter);
 }
开发者ID:aiesh,项目名称:magento2,代码行数:14,代码来源:DeleteSystemProductAttributeTest.php


示例4: processAssert

 /**
  * Check whether attribute is displayed in the advanced search form on the frontend.
  *
  * @param CatalogProductAttribute $attribute
  * @param AdvancedSearch $advancedSearch
  * @return void
  */
 public function processAssert(CatalogProductAttribute $attribute, AdvancedSearch $advancedSearch)
 {
     $advancedSearch->open();
     $formLabels = $advancedSearch->getForm()->getFormlabels();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $formLabels), 'Attribute is absent on advanced search form.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:AssertProductAttributeDisplayingOnSearchForm.php


示例5: processAssert

 /**
  * Assert that product attribute can be used on promo rules conditions.
  *
  * @param CatalogRuleIndex $catalogRuleIndex
  * @param CatalogRuleNew $catalogRuleNew
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(CatalogRuleIndex $catalogRuleIndex, CatalogRuleNew $catalogRuleNew, CatalogProductAttribute $attribute)
 {
     $catalogRuleIndex->open();
     $catalogRuleIndex->getGridPageActions()->addNew();
     $catalogRuleNew->getEditForm()->openTab('conditions');
     \PHPUnit_Framework_Assert::assertTrue($catalogRuleNew->getEditForm()->isAttributeInConditions($attribute->getFrontendLabel()), 'Product attribute can\'t be used on promo rules conditions.');
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:15,代码来源:AssertProductAttributeIsUsedPromoRules.php


示例6: processAssert

 /**
  * Check whether the attribute filter is displayed on the frontend in Layered navigation.
  *
  * @param CatalogCategoryView $catalogCategoryView
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param CmsIndex $cmsIndex
  * @param FixtureFactory $fixtureFactory
  * @return void
  */
 public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
 {
     $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
     $cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:AssertProductAttributeIsFilterable.php


示例7: isExistAttributeInSearchResult

 /**
  * Checking not exist attribute in search result.
  *
  * @param CatalogProductAttribute $productAttribute
  * @return bool
  */
 public function isExistAttributeInSearchResult($productAttribute)
 {
     $this->find($this->actionToggle)->click();
     $this->find($this->suggest)->setValue($productAttribute->getFrontendLabel());
     $this->waitResult();
     $attributeSelector = sprintf($this->searchArrtibute, $productAttribute->getFrontendLabel());
     return $this->find($this->searchResult)->find($attributeSelector, Locator::SELECTOR_XPATH)->isVisible();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:14,代码来源:Search.php


示例8: processAssert

 /**
  * Assert that deleted attribute can't be added to attribute set on Product Page via Add Attribute control.
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductNew $newProductPage
  * @return void
  */
 public function processAssert(CatalogProductAttribute $productAttribute, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('simple');
     $newProductPage->getFormPageActions()->addNewAttribute();
     $filter = ['label' => $productAttribute->getFrontendLabel()];
     \PHPUnit_Framework_Assert::assertFalse($newProductPage->getProductForm()->getAttributesSearchGrid()->isRowVisible($filter), 'Attribute \'' . $productAttribute->getFrontendLabel() . '\' is found in Attributes grid.');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:AssertProductAttributeAbsenceInSearchOnProductForm.php


示例9: hasHtmlTagInAttributeValue

 /**
  * Check if attribute value contains tag.
  *
  * @param CatalogProductAttribute $attribute
  * @return bool
  */
 public function hasHtmlTagInAttributeValue(CatalogProductAttribute $attribute)
 {
     $data = $attribute->getData();
     $defaultValue = preg_grep('/^default_value/', array_keys($data));
     $selector = $this->resolveHtmlStructure($data[array_shift($defaultValue)]);
     $element = $this->getProductAttributes()[$attribute->getFrontendLabel()];
     return $this->checkHtmlTagStructure($element, $selector)->isVisible();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:Additional.php


示例10: processAssert

 /**
  * Check whether there is an opportunity to compare products using given attribute.
  *
  * @param InjectableFixture $product
  * @param CatalogProductAttribute $attribute
  * @param BrowserInterface $browser
  * @param CatalogProductView $catalogProductView
  * @param CatalogProductCompare $catalogProductCompare
  */
 public function processAssert(InjectableFixture $product, CatalogProductAttribute $attribute, BrowserInterface $browser, CatalogProductView $catalogProductView, CatalogProductCompare $catalogProductCompare)
 {
     $browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     $catalogProductView->getViewBlock()->clickAddToCompare();
     $catalogProductCompare->open();
     $label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
     \PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogProductCompare->getCompareProductsBlock()->getComparableAttributes()), 'Attribute is absent on product compare page.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AssertProductAttributeIsComparable.php


示例11: testDeleteProductAttribute

 /**
  * Run DeleteProductAttributeEntity test.
  *
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductAttributeIndex $attributeIndex
  * @param CatalogProductAttributeNew $attributeNew
  * @return void
  */
 public function testDeleteProductAttribute(CatalogProductAttribute $attribute, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
 {
     //Precondition
     $attribute->persist();
     //Steps
     $attributeIndex->open();
     $attributeIndex->getGrid()->searchAndOpen(['frontend_label' => $attribute->getFrontendLabel()]);
     $attributeNew->getPageActions()->delete();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:17,代码来源:DeleteProductAttributeEntityTest.php


示例12: processAssert

 /**
  * Assert check whether the attribute is used to create a configurable products
  *
  * @param CatalogProductAttribute $productAttribute
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductIndex $productGrid
  * @param FixtureFactory $fixtureFactory
  * @param CatalogProductNew $newProductPage
  */
 public function processAssert(CatalogProductAttribute $attribute, CatalogProductIndex $productGrid, FixtureFactory $fixtureFactory, CatalogProductNew $newProductPage, CatalogProductAttribute $productAttribute = null)
 {
     $this->attribute = !is_null($productAttribute) ? $productAttribute : $attribute;
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('configurable');
     $productConfigurable = $fixtureFactory->createByCode('catalogProductConfigurable', ['dataSet' => 'default', 'data' => ['configurable_attributes_data' => ['preset' => 'one_variation', 'attributes' => [$this->attribute]]]]);
     $productBlockForm = $newProductPage->getForm();
     $productBlockForm->fill($productConfigurable);
     \PHPUnit_Framework_Assert::assertTrue($newProductPage->getForm()->findAttribute($this->attribute->getFrontendLabel()), "Product attribute is absent on the product page.");
 }
开发者ID:aiesh,项目名称:magento2,代码行数:19,代码来源:AssertProductAttributeIsConfigurable.php


示例13: isExistAttributeInSearchResult

 /**
  * Checking not exist attribute in search result
  *
  * @param CatalogProductAttribute $productAttribute
  * @return bool
  */
 public function isExistAttributeInSearchResult($productAttribute)
 {
     $this->find($this->actionToggle)->click();
     $this->find($this->suggest)->setValue($productAttribute->getFrontendLabel());
     $this->waitResult();
     if ($this->find($this->searchResult)->getText() == $productAttribute->getFrontendLabel()) {
         return true;
     }
     return false;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:16,代码来源:Search.php


示例14: processAssert

 /**
  * Check whether the attribute is unique.
  *
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductSimple $product,
  * @param FixtureFactory $fixtureFactory
  * @throws \Exception
  * @return void
  */
 public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, CatalogProductSimple $product, FixtureFactory $fixtureFactory)
 {
     $simpleProduct = $fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['attribute_set_id' => ['attribute_set' => $product->getDataFieldConfig('attribute_set_id')['source']->getAttributeSet()], 'custom_attribute' => $attribute]]);
     $catalogProductIndex->open()->getGridPageActionBlock()->addProduct('simple');
     $productForm = $catalogProductEdit->getProductForm();
     $productForm->fill($simpleProduct);
     $catalogProductEdit->getFormPageActions()->save();
     $failedAttributes = $productForm->getRequireNoticeAttributes($simpleProduct);
     $actualMessage = isset($failedAttributes['product-details'][$attribute->getFrontendLabel()]) ? $failedAttributes['product-details'][$attribute->getFrontendLabel()] : null;
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::UNIQUE_MESSAGE, $attribute->getFrontendLabel()), $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:AssertProductAttributeIsUnique.php


示例15: testCreateAttributeSet

 /**
  * Run CreateAttributeSetEntity test
  *
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function testCreateAttributeSet(CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute)
 {
     $productAttribute->persist();
     //Steps
     $this->productSetIndex->open();
     $this->productSetIndex->getPageActionsBlock()->addNew();
     $this->productSetAdd->getAttributeSetForm()->fill($attributeSet);
     $this->productSetAdd->getPageActions()->save();
     $this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttribute->getData());
     $this->productSetEdit->getPageActions()->save();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:18,代码来源:CreateAttributeSetEntityTest.php


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


示例17: processAssert

 /**
  * Assert that deleted attribute can't be added to attribute set on Product Page via Add Attribute control.
  *
  * @param CatalogProductAttribute $productAttribute
  * @param ConfigurableProduct $assertProduct
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductNew $newProductPage
  * @return void
  */
 public function processAssert(CatalogProductAttribute $productAttribute, ConfigurableProduct $assertProduct, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('simple');
     /** @var VariationsTab $variationsTab */
     $newProductPage->getProductForm()->fill($assertProduct);
     $variationsTab = $newProductPage->getProductForm()->getSection(self::TAB_VARIATIONS);
     $variationsTab->createConfigurations();
     $attributesGrid = $variationsTab->getAttributeBlock()->getAttributesGrid();
     \PHPUnit_Framework_Assert::assertFalse($attributesGrid->isRowVisible(['frontend_label' => $productAttribute->getFrontendLabel()]), "Product attribute found in Attribute Search form.");
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:20,代码来源:AssertProductAttributeAbsenceInVariationsSearch.php


示例18: processAssert

 /**
  * Assert that after save a attribute set on edit product set page displays:
  * 1. Correct attribute set name in Attribute set name field passed from fixture
  * 2. Created Product Attribute (if was added)
  *
  * @param CatalogProductSetIndex $productSet
  * @param CatalogProductSetEdit $productSetEdit
  * @param CatalogAttributeSet $attributeSet
  * @param CatalogProductAttribute $productAttribute
  * @return void
  */
 public function processAssert(CatalogProductSetIndex $productSet, CatalogProductSetEdit $productSetEdit, CatalogAttributeSet $attributeSet, CatalogProductAttribute $productAttribute = null)
 {
     $filterAttribute = ['set_name' => $attributeSet->getAttributeSetName()];
     $productSet->open();
     $productSet->getGrid()->searchAndOpen($filterAttribute);
     \PHPUnit_Framework_Assert::assertEquals($filterAttribute['set_name'], $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName(), 'Attribute Set not found' . "\nExpected: " . $filterAttribute['set_name'] . "\nActual: " . $productSetEdit->getAttributeSetEditBlock()->getAttributeSetName());
     if ($productAttribute !== null) {
         $attributeLabel = $productAttribute->getFrontendLabel();
         \PHPUnit_Framework_Assert::assertTrue($productSetEdit->getAttributeSetEditBlock()->checkProductAttribute($attributeLabel), "Product Attribute is absent on Attribute Set Groups");
     }
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:22,代码来源:AssertAttributeSetForm.php


示例19: testUpdateProductAttribute

 /**
  * Run UpdateProductAttributeEntity test
  *
  * @param CatalogProductAttribute $productAttributeOriginal
  * @param CatalogProductAttribute $attribute
  * @param CatalogAttributeSet $productTemplate
  * @param CatalogProductAttributeIndex $attributeIndex
  * @param CatalogProductAttributeNew $attributeNew
  * @return void
  */
 public function testUpdateProductAttribute(CatalogProductAttribute $productAttributeOriginal, CatalogProductAttribute $attribute, CatalogAttributeSet $productTemplate, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
 {
     //Precondition
     $productTemplate->persist();
     $productAttributeOriginal->persist();
     $filter = ['attribute_code' => $productAttributeOriginal->getAttributeCode()];
     //Steps
     $attributeIndex->open();
     $attributeIndex->getGrid()->searchAndOpen($filter);
     $attributeNew->getAttributeForm()->fill($attribute);
     $attributeNew->getPageActions()->save();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:22,代码来源:UpdateProductAttributeEntityTest.php


示例20: processAssert

 /**
  * Assert check whether the attribute is used to create a configurable products.
  *
  * @param CatalogProductAttribute $attribute
  * @param ConfigurableProduct $assertProduct
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductNew $newProductPage
  */
 public function processAssert(CatalogProductAttribute $attribute, ConfigurableProduct $assertProduct, CatalogProductIndex $productGrid, CatalogProductNew $newProductPage)
 {
     $productGrid->open();
     $productGrid->getGridPageActionBlock()->addProduct('configurable');
     $productBlockForm = $newProductPage->getProductForm();
     $productBlockForm->fill($assertProduct);
     $productBlockForm->openTab('variations');
     /** @var \Magento\ConfigurableProduct\Test\Block\Adminhtml\Product\Edit\Tab\Variations\Config  $variationsTab */
     $variationsTab = $productBlockForm->getTab('variations');
     $variationsTab->createConfigurations();
     $attributesGrid = $variationsTab->getAttributeBlock()->getAttributesGrid();
     \PHPUnit_Framework_Assert::assertTrue($attributesGrid->isRowVisible(['frontend_label' => $attribute->getFrontendLabel()]), "Product attribute is absent on the product page.");
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:AssertProductAttributeIsConfigurable.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Fixture\CatalogProductSimple类代码示例发布时间:2022-05-23
下一篇:
PHP Product\CollectionFactory类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap