You are here

protected function NodeViewTest::createNodeWithBodyValue in Node Option Premium 8

Same name in this branch
  1. 8 tests/src/Functional/NodeViewTest.php \Drupal\Tests\nopremium\Functional\NodeViewTest::createNodeWithBodyValue()
  2. 8 tests/src/Kernel/NodeViewTest.php \Drupal\Tests\nopremium\Kernel\NodeViewTest::createNodeWithBodyValue()

Creates a node with body.

Parameters

string $body: The body text.

array $values: (optional) An associative array of values for the node.

Return value

\Drupal\node\NodeInterface The created node entity.

3 calls to NodeViewTest::createNodeWithBodyValue()
NodeViewTest::testSpecificContentTypeMessage in tests/src/Functional/NodeViewTest.php
Tests with specific content type message.
NodeViewTest::testViewNonPremiumNode in tests/src/Functional/NodeViewTest.php
Tests that the full content is displayed for a non-premium node.
NodeViewTest::testViewPremiumNode in tests/src/Functional/NodeViewTest.php
Tests that the premium message is displayed for a premium node.

File

tests/src/Functional/NodeViewTest.php, line 40

Class

NodeViewTest
Tests displaying nodes.

Namespace

Drupal\Tests\nopremium\Functional

Code

protected function createNodeWithBodyValue($body, array $values = []) {
  $values += [
    'type' => 'foo',
    'body' => [
      [
        'value' => $body,
        'format' => filter_default_format(),
      ],
    ],
  ];
  return $this
    ->drupalCreateNode($values);
}