public function ProductAttributeValueTest::testProductAttributeValue in Commerce Migrate 3.0.x
Same name in this branch
- 3.0.x modules/magento/tests/src/Kernel/Migrate/magento2/ProductAttributeValueTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductAttributeValueTest::testProductAttributeValue()
- 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc7/ProductAttributeValueTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\ProductAttributeValueTest::testProductAttributeValue()
- 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc6/ProductAttributeValueTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\ProductAttributeValueTest::testProductAttributeValue()
Same name and namespace in other branches
- 8.2 modules/magento/tests/src/Kernel/Migrate/magento2/ProductAttributeValueTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductAttributeValueTest::testProductAttributeValue()
- 3.1.x modules/magento/tests/src/Kernel/Migrate/magento2/ProductAttributeValueTest.php \Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2\ProductAttributeValueTest::testProductAttributeValue()
Tests product attribute value migration.
File
- modules/
magento/ tests/ src/ Kernel/ Migrate/ magento2/ ProductAttributeValueTest.php, line 51
Class
- ProductAttributeValueTest
- Tests product attribute value migration.
Namespace
Drupal\Tests\commerce_migrate_magento\Kernel\Migrate\magento2Code
public function testProductAttributeValue() {
$this
->assertProductAttributeValueEntity('1', 'activity', 'Gym', 'Gym', '0');
$this
->assertProductAttributeValueEntity('2', 'activity', 'Hiking', 'Hiking', '0');
$this
->assertProductAttributeValueEntity('3', 'activity', 'Trail', 'Trail', '0');
$this
->assertProductAttributeValueEntity('4', 'activity', 'Urban', 'Urban', '0');
$this
->assertProductAttributeValueEntity('5', 'erin_recommends', 'Yes', 'Yes', '0');
$this
->assertProductAttributeValueEntity('6', 'features_bags', 'Audio Pocket', 'Audio Pocket', '0');
$this
->assertProductAttributeValueEntity('7', 'features_bags', 'Waterproof', 'Waterproof', '0');
$this
->assertProductAttributeValueEntity('8', 'features_bags', 'Lightweight', 'Lightweight', '0');
$this
->assertProductAttributeValueEntity('9', 'features_bags', 'Laptop Sleeve', 'Laptop Sleeve', '0');
// Test that all the attribute options are available for an attribute.
$attribute = ProductAttribute::load('material');
$expected_attributes = [
'Burlap',
'Canvas',
'Cocona® performance fabric',
'CoolTech™',
'Cotton',
'EverCool™',
'Fleece',
'Foam',
'HeatTec®',
'Hemp',
'Jersey',
'Leather',
'Linen',
'LumaTech™',
'Lycra®',
'Mesh',
'Metal',
'Microfiber',
'Nylon',
'Organic Cotton',
'Plastic',
'Polyester',
'Rayon',
'Rubber',
'Silicone',
'Spandex',
'Stainless Steel',
'Suede',
'Synthetic',
'TENCEL',
'Wool',
];
$actual_attributes = [];
/** @var \Drupal\commerce_product\Entity\ProductAttributeValue $attributeValue */
foreach ($attribute
->getValues() as $attributeValue) {
$actual_attributes[] = $attributeValue
->getName();
}
asort($actual_attributes);
$this
->assertSame($expected_attributes, $actual_attributes);
}