本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductAttribute::persist方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductAttribute::persist方法的具体用法?PHP CatalogProductAttribute::persist怎么用?PHP CatalogProductAttribute::persist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Fixture\CatalogProductAttribute
的用法示例。
在下文中一共展示了CatalogProductAttribute::persist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: testUpdateProductAttribute
/**
* Run UpdateProductAttributeEntity test
*
* @param CatalogProductAttribute $productAttributeOriginal
* @param CatalogProductAttribute $attribute
* @param CatalogAttributeSet $attributeSet
* @param CatalogProductAttributeIndex $attributeIndex
* @param CatalogProductAttributeNew $attributeNew
* @param CatalogProductSimple $productSimple
* @return array
*/
public function testUpdateProductAttribute(CatalogProductAttribute $productAttributeOriginal, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew, CatalogProductSimple $productSimple)
{
//Precondition
$attributeSet->persist();
$productAttributeOriginal->persist();
$filter = ['attribute_code' => $productAttributeOriginal->getAttributeCode()];
//Steps
$attributeIndex->open();
$attributeIndex->getGrid()->searchAndOpen($filter);
$attributeNew->getAttributeForm()->fill($attribute);
$attributeNew->getPageActions()->save();
$attribute = $this->prepareAttribute($attribute, $productAttributeOriginal);
$productSimple->persist();
return ['product' => $this->prepareProduct($productSimple, $attribute, $attributeSet)];
}
示例5: test
/**
* Run UpdateProductTemplate test
*
* @param CatalogAttributeSet $attributeSet
* @param CatalogAttributeSet $attributeSetOriginal
* @param CatalogProductAttribute $productAttributeOriginal
* @return void
*/
public function test(CatalogAttributeSet $attributeSet, CatalogAttributeSet $attributeSetOriginal, CatalogProductAttribute $productAttributeOriginal)
{
// Precondition
$attributeSetOriginal->persist();
$productAttributeOriginal->persist();
// Steps
$filter = ['set_name' => $attributeSetOriginal->getAttributeSetName()];
$this->productSetIndex->open();
$this->productSetIndex->getGrid()->searchAndOpen($filter);
$groupName = $attributeSet->getGroup();
$this->productSetEdit->getAttributeSetEditBlock()->addAttributeSetGroup($groupName);
$this->productSetEdit->getAttributeSetEditBlock()->moveAttribute($productAttributeOriginal->getData(), $groupName);
$this->productSetEdit->getAttributeSetEditForm()->fill($attributeSet);
$this->productSetEdit->getPageActions()->save();
}
示例6: testUpdateProductAttribute
/**
* Run UpdateProductAttributeEntity test
*
* @param CatalogProductAttribute $productAttributeOriginal
* @param CatalogProductAttribute $attribute
* @param CatalogAttributeSet $attributeSet
* @param CatalogProductAttributeIndex $attributeIndex
* @param CatalogProductAttributeNew $attributeNew
* @return array
*/
public function testUpdateProductAttribute(CatalogProductAttribute $productAttributeOriginal, CatalogProductAttribute $attribute, CatalogAttributeSet $attributeSet, CatalogProductAttributeIndex $attributeIndex, CatalogProductAttributeNew $attributeNew)
{
//Precondition
$attributeSet->persist();
$productAttributeOriginal->persist();
$filter = ['attribute_code' => $productAttributeOriginal->getAttributeCode()];
/** @var CatalogProductSimple $product */
$product = $this->fixtureFactory->createByCode('catalogProductSimple', ['dataset' => 'default', 'data' => ['attribute_set_id' => ['attribute_set' => $attributeSet]]]);
$product->persist();
$this->objectManager->create('Magento\\Catalog\\Test\\TestStep\\AddAttributeToAttributeSetStep', ['attribute' => $productAttributeOriginal, 'attributeSet' => $attributeSet])->run();
//Steps
$attributeIndex->open();
$attributeIndex->getGrid()->searchAndOpen($filter);
$attributeNew->getAttributeForm()->fill($attribute);
$attributeNew->getPageActions()->save();
$attribute = $this->prepareAttribute($attribute, $productAttributeOriginal);
return ['product' => $this->prepareProduct($product, $attribute, $attributeSet)];
}