You are here

public function DisplayAttachmentTest::testAttachment in Drupal 8

Same name and namespace 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()

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