You are here

protected function MigrateNodeTest::assertEntity in Zircon Profile 8

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

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

File

core/modules/node/src/Tests/Migrate/d7/MigrateNodeTest.php, line 81
Contains \Drupal\node\Tests\Migrate\d7\MigrateNodeTest.

Class

MigrateNodeTest
Tests node migration.

Namespace

Drupal\node\Tests\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
    ->assertTrue($node instanceof NodeInterface);
  $this
    ->assertIdentical($type, $node
    ->getType());
  $this
    ->assertIdentical($langcode, $node->langcode->value);
  $this
    ->assertIdentical($title, $node
    ->getTitle());
  $this
    ->assertIdentical($uid, $node
    ->getOwnerId());
  $this
    ->assertIdentical($status, $node
    ->isPublished());
  $this
    ->assertIdentical($created, $node
    ->getCreatedTime());
  if (isset($changed)) {
    $this
      ->assertIdentical($changed, $node
      ->getChangedTime());
  }
  $this
    ->assertIdentical($promoted, $node
    ->isPromoted());
  $this
    ->assertIdentical($sticky, $node
    ->isSticky());
}