function MigrateNodeTypeTest::assertEntity

Tests a single node type.

@dataProvider testNodeTypeDataProvider

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.

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 47

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->assertIdentical($label, $entity->label());
  $this->assertIdentical($description, $entity->getDescription());
  $this->assertIdentical($help, $entity->getHelp());
  $this->assertIdentical($display_submitted, $entity->displaySubmitted(), 'Submission info is displayed');
  $this->assertIdentical($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->assertIdentical($body_label, $body->label());
  }
  $this->assertSame($expected_available_menus, $entity->getThirdPartySetting('menu_ui', 'available_menus'));
  $this->assertSame($expected_parent, $entity->getThirdPartySetting('menu_ui', 'parent'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.