function DisplayAttachmentTest::testAttachment

Same name and namespace in other branches
  1. 8.9.x 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()
  3. 11.x 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 50

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.