You are here

protected function MigrateNodeTest::assertEntity in Drupal 8

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

Asserts various aspects of a node.

Parameters

string $id: The node ID.

string $type: The node type.

string $langcode: The expected language code.

string $title: The expected title.

int $uid: The expected author ID.

bool $status: The expected status of the node.

int $created: The expected creation time.

int $changed: The expected modification time.

bool $promoted: Whether the node is expected to be promoted to the front page.

bool $sticky: Whether the node is expected to be sticky.

Overrides FileMigrationSetupTrait::assertEntity

1 call to MigrateNodeTest::assertEntity()
MigrateNodeTest::testNode in core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php
Test node migration from Drupal 7 to 8.

File

core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTest.php, line 106

Class

MigrateNodeTest
Tests node migration.

Namespace

Drupal\Tests\node\Kernel\Migrate\d7

Code

protected function assertEntity($id, $type, $langcode, $title, $uid, $status, $created, $changed, $promoted, $sticky) {

  /** @var \Drupal\node\NodeInterface $node */
  $node = Node::load($id);
  $this
    ->assertInstanceOf(NodeInterface::class, $node);
  $this
    ->assertEquals($type, $node
    ->getType());
  $this
    ->assertEquals($langcode, $node->langcode->value);
  $this
    ->assertEquals($title, $node
    ->getTitle());
  $this
    ->assertEquals($uid, $node
    ->getOwnerId());
  $this
    ->assertEquals($status, $node
    ->isPublished());
  $this
    ->assertEquals($created, $node
    ->getCreatedTime());
  if (isset($changed)) {
    $this
      ->assertEquals($changed, $node
      ->getChangedTime());
  }
  $this
    ->assertEquals($promoted, $node
    ->isPromoted());
  $this
    ->assertEquals($sticky, $node
    ->isSticky());
}