You are here

public function BasicTest::testNaturalSortDefaultBeginningWords in Views Natural Sort 8.2

File

tests/src/Kernel/BasicTest.php, line 42

Class

BasicTest
@group views_natural_sort

Namespace

Drupal\Tests\views_natural_sort\Kernel

Code

public function testNaturalSortDefaultBeginningWords() {
  $node1 = Node::create([
    'type' => 'views_natural_sort_test_content',
    'title' => 'A Stripped Zebra',
  ]);
  $node1
    ->save();
  $node2 = Node::create([
    'type' => 'views_natural_sort_test_content',
    'title' => 'Oklahoma',
  ]);
  $node2
    ->save();
  $node3 = Node::create([
    'type' => 'views_natural_sort_test_content',
    'title' => 'The King And I',
  ]);
  $node3
    ->save();
  $view = Views::getView('views_natural_sort_test');
  $view
    ->setDisplay();
  $view
    ->preview('default');
  $this
    ->assertIdenticalResultset($view, [
    [
      'title' => 'The King And I',
    ],
    [
      'title' => 'Oklahoma',
    ],
    [
      'title' => 'A Stripped Zebra',
    ],
  ], [
    'title' => 'title',
  ]);
}