protected function CommentFieldInstanceTest::assertEntity in Commerce Migrate 3.0.x
Same name and namespace in other branches
- 8.2 modules/ubercart/tests/src/Kernel/Migrate/uc7/CommentFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\CommentFieldInstanceTest::assertEntity()
- 3.1.x modules/ubercart/tests/src/Kernel/Migrate/uc7/CommentFieldInstanceTest.php \Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7\CommentFieldInstanceTest::assertEntity()
Asserts a comment field instance entity.
Parameters
string $bundle: The bundle ID.
string $field_name: The field name.
int $default_value: The field's default_value setting.
int $default_mode: The field's default_mode setting.
int $per_page: The field's per_page setting.
bool $anonymous: The field's anonymous setting.
int $form_location: The field's form_location setting.
bool $preview: The field's preview setting.
1 call to CommentFieldInstanceTest::assertEntity()
- CommentFieldInstanceTest::testMigration in modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ CommentFieldInstanceTest.php - Tests the migrated fields.
File
- modules/
ubercart/ tests/ src/ Kernel/ Migrate/ uc7/ CommentFieldInstanceTest.php, line 57
Class
- CommentFieldInstanceTest
- Tests the migration of comment field instances from Drupal 7.
Namespace
Drupal\Tests\commerce_migrate_ubercart\Kernel\Migrate\uc7Code
protected function assertEntity($bundle, $field_name, $default_value, $default_mode, $per_page, $anonymous, $form_location, $preview) {
$entity = FieldConfig::load("commerce_product.{$bundle}.{$field_name}");
$this
->assertInstanceOf(FieldConfig::class, $entity);
$this
->assertSame('commerce_product', $entity
->getTargetEntityTypeId());
$this
->assertSame('Comments', $entity
->label());
$this
->assertTrue($entity
->isRequired());
$this
->assertSame($bundle, $entity
->getTargetBundle());
$this
->assertSame($field_name, $entity
->getFieldStorageDefinition()
->getName());
$this
->assertSame($default_value, $entity
->get('default_value')[0]['status']);
$this
->assertSame($default_mode, $entity
->getSetting('default_mode'));
$this
->assertSame($per_page, $entity
->getSetting('per_page'));
$this
->assertSame($anonymous, $entity
->getSetting('anonymous'));
$this
->assertSame($form_location, $entity
->getSetting('form_location'));
$this
->assertSame($preview, $entity
->getSetting('preview'));
}