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


PHP CatalogProductAttribute::persist方法代码示例

本文整理汇总了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();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:17,代码来源:DeleteProductAttributeEntityTest.php

示例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();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:18,代码来源:CreateAttributeSetEntityTest.php

示例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();
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:22,代码来源:UpdateProductAttributeEntityTest.php

示例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)];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:26,代码来源:UpdateProductAttributeEntityTest.php

示例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();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:23,代码来源:UpdateAttributeSetTest.php

示例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)];
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:28,代码来源:UpdateProductAttributeEntityTest.php


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