You are here

protected function MigrateCommentFieldInstanceTest::assertEntity in Drupal 10

Same name in this branch
  1. 10 core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentFieldInstanceTest::assertEntity()
  2. 10 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()
  2. 9 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentFieldInstanceTest::assertEntity()

Asserts a comment field instance entity.

@internal

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.

int $anonymous: The field's anonymous setting.

bool $form_location: The field's form_location setting.

int $preview: The field's preview setting.

1 call to MigrateCommentFieldInstanceTest::assertEntity()
MigrateCommentFieldInstanceTest::testMigration in core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php
Tests the migrated fields.

File

core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldInstanceTest.php, line 56

Class

MigrateCommentFieldInstanceTest
Tests the migration of comment field instances from Drupal 7.

Namespace

Drupal\Tests\comment\Kernel\Migrate\d7

Code

protected function assertEntity(string $bundle, string $field_name, int $default_value, int $default_mode, int $per_page, int $anonymous, bool $form_location, int $preview) : void {
  $entity = FieldConfig::load("node.{$bundle}.{$field_name}");
  $this
    ->assertInstanceOf(FieldConfig::class, $entity);
  $this
    ->assertSame('node', $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'));
}