'article', 'name' => 'Article']); $node_type->save(); node_add_body_field($node_type); // Create a user and a node. $account = $this->createUser(); $body = $this->randomMachineName(32); $summary = $this->randomMachineName(16); /** @var $node \Drupal\node\NodeInterface */ $node = Node::create([ 'type' => 'article', 'tnid' => 0, 'uid' => $account->id(), 'title' => 'Testing Views tokens', 'body' => [['value' => $body, 'summary' => $summary, 'format' => 'plain_text']], ]); $node->save(); $this->drupalGet('test_node_tokens'); // Body: {{ body }}
$this->assertRaw("Body:

$body

"); // Raw value: {{ body__value }}
$this->assertRaw("Raw value: $body"); // Raw summary: {{ body__summary }}
$this->assertRaw("Raw summary: $summary"); // Raw format: {{ body__format }}
$this->assertRaw("Raw format: plain_text"); } }