You are here

protected function MigrateNodeTypeTest::assertEntity in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/node/src/Tests/Migrate/d7/MigrateNodeTypeTest.php \Drupal\node\Tests\Migrate\d7\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/src/Tests/Migrate/d7/MigrateNodeTypeTest.php
Tests Drupal 7 node type to Drupal 8 migration.

File

core/modules/node/src/Tests/Migrate/d7/MigrateNodeTypeTest.php, line 52
Contains \Drupal\node\Tests\Migrate\d7\MigrateNodeTypeTest.

Class

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

Namespace

Drupal\node\Tests\Migrate\d7

Code

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

  /** @var \Drupal\node\NodeTypeInterface $entity */
  $entity = NodeType::load($id);
  $this
    ->assertTrue($entity instanceof NodeTypeInterface);
  $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
    ->isNewRevision(), 'Is a new revision');
  if ($body_label) {

    /** @var \Drupal\field\FieldConfigInterface $body */
    $body = FieldConfig::load('node.' . $id . '.body');
    $this
      ->assertTrue($body instanceof FieldConfigInterface);
    $this
      ->assertIdentical($body_label, $body
      ->label());
  }
}