public function FieldUnitTest::testExclude

Tests the exclude setting.

File

drupal/core/modules/views/lib/Drupal/views/Tests/Handler/FieldUnitTest.php, line 210
Contains \Drupal\views\Tests\Handler\FieldUnitTest.

Class

FieldUnitTest
Tests the generic field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testExclude() {
  $view = views_get_view('test_field_output');
  $view
    ->initHandlers();

  // Hide the field and see whether it's rendered.
  $view->field['name']->options['exclude'] = TRUE;
  $output = $view
    ->preview();
  foreach ($this
    ->dataSet() as $entry) {
    $this
      ->assertNotSubString($output, $entry['name']);
  }

  // Show and check the field.
  $view->field['name']->options['exclude'] = FALSE;
  $output = $view
    ->preview();
  foreach ($this
    ->dataSet() as $entry) {
    $this
      ->assertSubString($output, $entry['name']);
  }
}