public function CommerceMigrateTestTrait::assertProductTypeEntity in Commerce Migrate 8.2
Same name and namespace in other branches
- 3.1.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertProductTypeEntity()
- 3.0.x tests/src/Kernel/CommerceMigrateTestTrait.php \Drupal\Tests\commerce_migrate\Kernel\CommerceMigrateTestTrait::assertProductTypeEntity()
Asserts a product type entity.
Parameters
string $id: The product type id.
string $label: The expected label.
string $description: The expected description.
string $variation_type_id: The expected product variation type id.
5 calls to CommerceMigrateTestTrait::assertProductTypeEntity()
- ProductTypeTest::testProductType in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ ProductTypeTest.php - Test product type migration.
- ProductTypeTest::testProductType in modules/
commerce/ tests/ src/ Kernel/ Migrate/ commerce1/ ProductTypeTest.php - Test product type migration from Drupal 7 to 8.
- ProductTypeTest::testProductType in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc6/ ProductTypeTest.php - Test product type migration.
- ProductTypeTest::testProductType in modules/
shopify/ tests/ src/ Kernel/ Migrate/ ProductTypeTest.php - Test product type migration.
- ProductTypeTest::testProductType in modules/
magento/ tests/ src/ Kernel/ Migrate/ magento2/ ProductTypeTest.php - Test product type migration.
File
- tests/
src/ Kernel/ CommerceMigrateTestTrait.php, line 519
Class
- CommerceMigrateTestTrait
- Helper function to test migrations.
Namespace
Drupal\Tests\commerce_migrate\KernelCode
public function assertProductTypeEntity($id, $label, $description, $variation_type_id) {
$product_type = ProductType::load($id);
$this
->assertInstanceOf(ProductType::class, $product_type);
/** @var \Drupal\Core\Entity\EntityFieldManagerInterface $entity_field_manager */
$entity_field_manager = \Drupal::service('entity_field.manager');
$field_definitions = $entity_field_manager
->getFieldDefinitions('commerce_product', $id);
$this
->assertArrayHasKey('stores', $field_definitions);
$this
->assertArrayHasKey('body', $field_definitions);
$this
->assertArrayHasKey('variations', $field_definitions);
$this
->assertSame($label, $product_type
->label());
$this
->assertSame($description, $product_type
->getDescription());
$this
->assertSame($variation_type_id, $product_type
->getVariationTypeId());
}