You are here

public function FieldTest::testExclude in Views (for Drupal 7) 8.3

Tests the exclude setting.

File

lib/Drupal/views/Tests/Handler/FieldTest.php, line 524
Definition of Drupal\views\Tests\Handler\FieldTest.

Class

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