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.

5 calls to NodeViewTest::createNodeWithBodyValue()
NodeViewTest::testViewModesSetting in tests/src/Kernel/NodeViewTest.php
Tests view modes setting.
NodeViewTest::testViewNonPremiumNodeWithCustomViewMode in tests/src/Kernel/NodeViewTest.php
Tests displaying a non-premium node on custom view mode.
NodeViewTest::testViewPremiumNode in tests/src/Kernel/NodeViewTest.php
Tests if premium message is shown on full view mode by default.
NodeViewTest::testViewPremiumNodeInTeaserViewMode in tests/src/Kernel/NodeViewTest.php
Tests that a read more link is shown in teasers for premium nodes.
NodeViewTest::testWithCustomViewMode in tests/src/Kernel/NodeViewTest.php
Tests if premium message is shown on custom view mode by default.

File

tests/src/Kernel/NodeViewTest.php, line 60

Class

NodeViewTest
Tests displaying nodes.

Namespace

Drupal\Tests\nopremium\Kernel

Code

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