You are here

public function NodeViewTest::testViewNonPremiumNodeWithCustomViewMode in Node Option Premium 8

Tests displaying a non-premium node on custom view mode.

File

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

Class

NodeViewTest
Tests displaying nodes.

Namespace

Drupal\Tests\nopremium\Kernel

Code

public function testViewNonPremiumNodeWithCustomViewMode() {
  $this
    ->createViewModeAndDisplay('foo');

  // Create a public node.
  $node = $this
    ->createNodeWithBodyValue('Lorem ipsum');
  $build = $this->viewBuilder
    ->view($node, 'foo');
  $output = (string) $this->renderer
    ->renderPlain($build);
  $this
    ->assertStringNotContainsString('The full content of this page is available to premium users only.', $output);
  $this
    ->assertStringContainsString('Lorem ipsum', $output);
}