protected function DisplayAttachmentTest::testAttachment

Tests the attachment plugin.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Plugin/DisplayAttachmentTest.php, line 42
Contains \Drupal\views\Tests\Plugin\DisplayAttachmentTest.

Class

DisplayAttachmentTest
Tests the attachment display plugin.

Namespace

Drupal\views\Tests\Plugin

Code

protected function testAttachment() {

  // @todo Remove that once http://drupal.org/node/1828444 got in.
  \Drupal::state()
    ->set('menu_rebuild_needed', TRUE);
  $this
    ->drupalGet('test-display-attachment');
  $result = $this
    ->xpath('//div[contains(@class, "view-content")]');
  $this
    ->assertEqual(count($result), 2, 'Both actual view and the attachment is rendered.');
  $result = $this
    ->xpath('//div[contains(@class, "attachment-after")]');
  $this
    ->assertEqual(count($result), 0, 'The attachment is not rendered after the actual view.');
  $result = $this
    ->xpath('//div[contains(@class, "attachment-before")]');
  $this
    ->assertEqual(count($result), 1, 'The attachment is rendered before the actual view.');
}