You are here

public function ExtraFieldDisplayFieldTest::testFirstNodeTypeFields in Extra Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/ExtraFieldDisplayFieldTest.php \Drupal\Tests\extra_field\Functional\ExtraFieldDisplayFieldTest::testFirstNodeTypeFields()

Test the output of field with single value item.

File

tests/src/Functional/ExtraFieldDisplayFieldTest.php, line 48

Class

ExtraFieldDisplayFieldTest
Tests the extra_field Display with field wrapper.

Namespace

Drupal\Tests\extra_field\Functional

Code

public function testFirstNodeTypeFields() {
  $url = $this->firstNode
    ->toUrl();
  $this
    ->drupalGet($url);

  // Test the output of field with single value item.
  $this
    ->assertSession()
    ->pageTextContains('Output from SingleTextFieldTest');
  $this
    ->assertSession()
    ->pageTextContains('Single text');

  // Test the output of field with multiple value items.
  $this
    ->assertSession()
    ->pageTextContains('Aap');
  $this
    ->assertSession()
    ->pageTextContains('Noot');
  $this
    ->assertSession()
    ->pageTextContains('Zus');

  // Test the output of field with cacheable dependency.
  $this
    ->assertSession()
    ->pageTextContains('Related pages');
  $this
    ->assertSession()
    ->pageTextContains($this->secondNode
    ->label());
  $this
    ->assertCacheTag('node:' . $this->secondNode
    ->id());

  // Test the output of the empty field.
  $this
    ->assertSession()
    ->pageTextNotContains('Empty field');
}