public function FieldUnitTest::testClickSortable

Tests whether the filters are click sortable as expected.

File

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

Class

FieldUnitTest
Tests the generic field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testClickSortable() {

  // Test that clickSortable is TRUE by default.
  $item = array(
    'table' => 'views_test_data',
    'field' => 'name',
  );
  $plugin = views_get_handler($item, 'field');
  $this
    ->assertTrue($plugin
    ->clickSortable(), 'TRUE as a default value is correct.');

  // Test that clickSortable is TRUE by when set TRUE in the data.
  $item['field'] = 'id';
  $plugin = views_get_handler($item, 'field');
  $this
    ->assertTrue($plugin
    ->clickSortable(), 'TRUE as a views data value is correct.');

  // Test that clickSortable is FALSE by when set FALSE in the data.
  $item['field'] = 'job';
  $plugin = views_get_handler($item, 'field');
  $this
    ->assertFalse($plugin
    ->clickSortable(), 'FALSE as a views data value is correct.');
}