You are here

public function NodeViewTest::testSpecificContentTypeMessage in Node Option Premium 8

Tests with specific content type message.

File

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

Class

NodeViewTest
Tests displaying nodes.

Namespace

Drupal\Tests\nopremium\Functional

Code

public function testSpecificContentTypeMessage() {

  // Change message for 'foo' content type.
  $this
    ->config('nopremium.settings')
    ->set('messages', [
    'foo' => 'The foo message',
  ])
    ->save();

  // Create a premium node.
  $node = $this
    ->createNodeWithBodyValue('Lorem ipsum', [
    'premium' => TRUE,
  ]);
  $this
    ->drupalGet($node
    ->toUrl());
  $this
    ->assertSession()
    ->pageTextNotContains('Lorem ipsum');
  $this
    ->assertSession()
    ->pageTextContains('The foo message');
}