You are here

public function DisplayAttachmentTest::testAttachment in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php \Drupal\Tests\views\Functional\Plugin\DisplayAttachmentTest::testAttachment()
  2. 10 core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php \Drupal\Tests\views\Functional\Plugin\DisplayAttachmentTest::testAttachment()

Tests the attachment plugin.

File

core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php, line 47

Class

DisplayAttachmentTest
Tests the attachment display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testAttachment() {
  $this
    ->drupalGet('test-display-attachment');

  // Verify that both actual view and the attachment are rendered.
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[contains(@class, "view-content")]', 2);

  // Verify that the attachment is not rendered after the actual view.
  $this
    ->assertSession()
    ->elementNotExists('xpath', '//div[contains(@class, "attachment-after")]');

  // Verify that the attachment is rendered before the actual view.
  $this
    ->assertSession()
    ->elementsCount('xpath', '//div[contains(@class, "attachment-before")]', 1);
}