You are here

protected function AttributeFieldInstanceTest::assertEntity in Commerce Migrate 8.2

Same name in this branch
  1. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/AttributeFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\AttributeFieldInstanceTest::assertEntity()
  2. 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc6/AttributeFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc6\AttributeFieldInstanceTest::assertEntity()
Same name and namespace in other branches
  1. 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc7/AttributeFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\AttributeFieldInstanceTest::assertEntity()
  2. 3.0.x modules/ubercart/tests/src/Kernel/Migrate/uc7/AttributeFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\AttributeFieldInstanceTest::assertEntity()

Asserts various aspects of a field config entity.

Parameters

string $name: The field instance machine name.

string $type: The field type.

string $bundle: The target bundle.

string $label: The field label.

string $description: The field description.

bool $translatable: Indicates if the field is translatable.

1 call to AttributeFieldInstanceTest::assertEntity()
AttributeFieldInstanceTest::testAttributeInstance in modules/ubercart/tests/src/Kernel/Migrate/uc7/AttributeFieldInstanceTest.php
Test attribute field instance migration.

File

modules/ubercart/tests/src/Kernel/Migrate/uc7/AttributeFieldInstanceTest.php, line 62

Class

AttributeFieldInstanceTest
Tests attribute field instance migration.

Namespace

Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7

Code

protected function assertEntity($name, $type, $bundle, $label, $description, $translatable) {
  $id = 'commerce_product_variation.default.attribute_' . $name;

  /** @var \Drupal\field\FieldConfigInterface $field */
  $field = FieldConfig::load($id);
  $this
    ->assertTrue($field instanceof FieldConfigInterface);
  $this
    ->assertSame($type, $field
    ->getType());
  $this
    ->assertSame($bundle, $field
    ->getTargetBundle());
  $this
    ->assertSame($label, $field
    ->label());
  $this
    ->assertSame($description, $field
    ->getDescription());
  $this
    ->assertSame('default:commerce_product_attribute_value', $field
    ->getSetting('handler'));
  $this
    ->assertSame([
    'target_bundles' => [
      $name,
    ],
  ], $field
    ->getSetting('handler_settings'));
  $this
    ->assertSame('commerce_product_attribute_value', $field
    ->getSetting('target_type'));
  $this
    ->assertEquals($translatable, $field
    ->isTranslatable());
  $this
    ->assertSame('commerce_product_variation', $field
    ->getTargetEntityTypeId());
}