![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/integration/testsuite/Magento/Weee/_files/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ declare(strict_types=1); use Magento\Catalog\Model\Product; use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\Workaround\Override\Fixture\Resolver; Resolver::getInstance()->requireDataFixture('Magento/Weee/_files/product_with_fpt.php'); /** @var \Magento\Catalog\Setup\CategorySetup $installer */ $installer = Bootstrap::getObjectManager()->create( \Magento\Catalog\Setup\CategorySetup::class ); $attributeSetId = $installer->getAttributeSetId('catalog_product', 'Default'); $entityModel = Bootstrap::getObjectManager()->create(\Magento\Eav\Model\Entity::class); $entityTypeId = $entityModel->setType(Product::ENTITY)->getTypeId(); $groupId = $installer->getDefaultAttributeGroupId($entityTypeId, $attributeSetId); /** @var \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute */ $attribute = Bootstrap::getObjectManager()->create( \Magento\Catalog\Model\ResourceModel\Eav\Attribute::class ); $attribute->setAttributeCode( 'fixed_product_attribute' )->setEntityTypeId( $entityTypeId )->setAttributeGroupId( $groupId )->setAttributeSetId( $attributeSetId )->setFrontendLabel( 'fixed_product_attribute_front_label' )->setFrontendInput( 'weee' )->setIsUserDefined( 1 )->save(); /** @var $product \Magento\Catalog\Model\Product */ $product = Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); $product = $product->loadByAttribute('sku', 'simple-with-ftp'); if ($product && $product->getId()) { $product->setFixedProductAttribute( [['website_id' => 0, 'country' => 'US', 'state' => 0, 'price' => 10.00, 'delete' => '']] )->save(); }