You are here

public function SortTimestampIdTest::testLogTimestampIdDescSort in Log entity 2.x

Tests the sorting: Timestamp/ID DESC.

File

tests/src/Kernel/SortTimestampIdTest.php, line 120

Class

SortTimestampIdTest
Tests for Drupal\log\Plugin\views\sort\LogTimestampIdSort handler.

Namespace

Drupal\Tests\log\Kernel

Code

public function testLogTimestampIdDescSort() {
  $view = Views::getView('log_test_view');
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')
    ->overrideOption('sorts', [
    'timestamp' => [
      'id' => 'timestamp',
      'table' => 'log_field_data',
      'field' => 'timestamp',
      'relationship' => 'none',
      'order' => 'DESC',
      'plugin_id' => 'log_standard',
    ],
  ]);
  $this
    ->executeView($view);
  $this
    ->assertEqual(3, count($view->result), 'The number of returned rows match.');
  $this
    ->assertIdenticalResultset($view, $this->expectedResultDESC, [
    'name' => 'name',
    'id' => 'id',
  ], 'DESC sort displays as expected');
  $view
    ->destroy();
  unset($view);
}