You are here

protected function MigrateNodeTypeTest::assertEntity in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest::assertEntity()
  2. 10 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest::assertEntity()

Tests a single node type.

Parameters

string $id: The node type ID.

string $label: The expected label.

string $description: The expected node type description.

string $help: The expected help text.

bool $display_submitted:

bool $new_revision:

array $expected_available_menus:

string $expected_parent:

string|null $body_label:

1 call to MigrateNodeTypeTest::assertEntity()
MigrateNodeTypeTest::testNodeType in core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php
Tests Drupal 7 node type to Drupal 8 migration.

File

core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php, line 50

Class

MigrateNodeTypeTest
Upgrade node types to node.type.*.yml.

Namespace

Drupal\Tests\node\Kernel\Migrate\d7

Code

protected function assertEntity($id, $label, $description, $help, $display_submitted, $new_revision, $expected_available_menus, $expected_parent, $body_label = NULL) {

  /** @var \Drupal\node\NodeTypeInterface $entity */
  $entity = NodeType::load($id);
  $this
    ->assertInstanceOf(NodeTypeInterface::class, $entity);
  $this
    ->assertSame($label, $entity
    ->label());
  $this
    ->assertSame($description, $entity
    ->getDescription());
  $this
    ->assertSame($help, $entity
    ->getHelp());
  $this
    ->assertSame($display_submitted, $entity
    ->displaySubmitted(), 'Submission info is displayed');
  $this
    ->assertSame($new_revision, $entity
    ->shouldCreateNewRevision(), 'Is a new revision');
  if ($body_label) {

    /** @var \Drupal\field\FieldConfigInterface $body */
    $body = FieldConfig::load('node.' . $id . '.body');
    $this
      ->assertInstanceOf(FieldConfigInterface::class, $body);
    $this
      ->assertSame($body_label, $body
      ->label());
  }
  $this
    ->assertSame($expected_available_menus, $entity
    ->getThirdPartySetting('menu_ui', 'available_menus'));
  $this
    ->assertSame($expected_parent, $entity
    ->getThirdPartySetting('menu_ui', 'parent'));
}