function MigrateNodeTypeTest::assertEntity
Same name in other branches
- 9 core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest::assertEntity()
- 8.9.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest::assertEntity()
- 11.x core/modules/node/tests/src/Kernel/Migrate/d7/MigrateNodeTypeTest.php \Drupal\Tests\node\Kernel\Migrate\d7\MigrateNodeTypeTest::assertEntity()
Tests a single node type.
@internal
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: If submission information is displayed.
bool $new_revision: If this is a new revision.
array|null $expected_available_menus: The expected menus.
string|null $expected_parent: The expected menu parents.
string|null $body_label: (optional) The label for the body field.
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 57
Class
- MigrateNodeTypeTest
- Upgrade node types to node.type.*.yml.
Namespace
Drupal\Tests\node\Kernel\Migrate\d7Code
protected function assertEntity(string $id, string $label, string $description, string $help, bool $display_submitted, bool $new_revision, ?array $expected_available_menus, ?string $expected_parent, ?string $body_label = NULL) : void {
/** @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'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.