function ExampleFixtureManagementTest::testNodeCreation
Create a node by using createNode() from NodeCreationTrait.
File
- 
              modules/
testing_example/ tests/ src/ Kernel/ ExampleFixtureManagementTest.php, line 92  
Class
- ExampleFixtureManagementTest
 - Demonstrate manipulating fixture data in a kernel test.
 
Namespace
Drupal\Tests\testing_example\KernelCode
public function testNodeCreation() {
  // Unless there's a specific reason to do so, strings in tests should not be
  // translated with t().
  $nodeTitle = 'Test Node!';
  /** @var \Drupal\node\NodeInterface $node */
  $node = $this->createNode([
    'title' => $nodeTitle,
    'type' => 'page',
    'uid' => $this->owner
      ->id(),
  ]);
  // Assert that the node we created has the title we expect.
  $this->assertEquals($nodeTitle, $node->getTitle());
}