public function ProductTest::assertProductEntityAdditions in Commerce Migrate 3.1.x
Same name and namespace in other branches
- 8.2 modules/csv_example/tests/src/Kernel/Migrate/ProductTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ProductTest::assertProductEntityAdditions()
- 3.0.x modules/csv_example/tests/src/Kernel/Migrate/ProductTest.php \Drupal\Tests\commerce_migrate_csv_example\Kernel\Migrate\ProductTest::assertProductEntityAdditions()
Asserts additions to product.
Parameters
int $id: The product id.
array $terms: An array of taxonomy field names and values.
array $suggested: An array of suggested products.
1 call to ProductTest::assertProductEntityAdditions()
- ProductTest::testProduct in modules/
csv_example/ tests/ src/ Kernel/ Migrate/ ProductTest.php - Test product migration from CSV source file.
File
- modules/
csv_example/ tests/ src/ Kernel/ Migrate/ ProductTest.php, line 255
Class
- ProductTest
- Tests Product migration.
Namespace
Drupal\Tests\commerce_migrate_csv_example\Kernel\MigrateCode
public function assertProductEntityAdditions($id, array $terms, array $suggested) {
$product = Product::load($id);
foreach ($terms as $name => $data) {
$this
->assertSame($data, $product
->get($name)
->getValue(), "Taxonomy {$name} is incorrect.");
}
$this
->assertSame($suggested, $product
->get('field_suggested_products')
->getValue());
}