public function NodeViewTest::testViewPremiumNode in Node Option Premium 8
Same name in this branch
- 8 tests/src/Functional/NodeViewTest.php \Drupal\Tests\nopremium\Functional\NodeViewTest::testViewPremiumNode()
- 8 tests/src/Kernel/NodeViewTest.php \Drupal\Tests\nopremium\Kernel\NodeViewTest::testViewPremiumNode()
Tests if premium message is shown on full view mode by default.
File
- tests/
src/ Kernel/ NodeViewTest.php, line 97
Class
- NodeViewTest
- Tests displaying nodes.
Namespace
Drupal\Tests\nopremium\KernelCode
public function testViewPremiumNode() {
// Create a premium node.
$node = $this
->createNodeWithBodyValue('Lorem ipsum', [
'premium' => TRUE,
]);
$build = $this->viewBuilder
->view($node, 'full');
$output = (string) $this->renderer
->renderPlain($build);
$this
->assertStringContainsString('The full content of this page is available to premium users only.', $output);
$this
->assertStringNotContainsString('Lorem ipsum', $output);
}