function DisplayAttachmentTest::testAttachment

Same name in other branches
  1. 9 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 47

Class

DisplayAttachmentTest
Tests the attachment display plugin.

Namespace

Drupal\Tests\views\Functional\Plugin

Code

public function testAttachment() {
    $this->drupalGet('test-display-attachment');
    $result = $this->xpath('//div[contains(@class, "view-content")]');
    $this->assertCount(2, $result, 'Both actual view and the attachment is rendered.');
    $result = $this->xpath('//div[contains(@class, "attachment-after")]');
    $this->assertCount(0, $result, 'The attachment is not rendered after the actual view.');
    $result = $this->xpath('//div[contains(@class, "attachment-before")]');
    $this->assertCount(1, $result, 'The attachment is rendered before the actual view.');
}

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