本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductAttribute类的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductAttribute类的具体用法?PHP CatalogProductAttribute怎么用?PHP CatalogProductAttribute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CatalogProductAttribute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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);
}
示例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);
}
示例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.');
}
示例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.');
}
示例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();
}
示例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();
}
示例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.');
}
示例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();
}
示例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.");
}
示例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;
}
示例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.');
}
示例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();
}