function SortTest::testSorted

Same name in this branch
  1. 11.x core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest::testSorted()
Same name in other branches
  1. 9 core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest::testSorted()
  2. 10 core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest::testSorted()
  3. 10 core/tests/Drupal/Tests/CSpell/SortTest.php \Drupal\Tests\CSpell\SortTest::testSorted()

Tests that the file is properly sorted.

File

core/tests/Drupal/Tests/CSpell/SortTest.php, line 38

Class

SortTest
Tests that the dictionary.txt file is properly sorted.

Namespace

Drupal\Tests\CSpell

Code

public function testSorted() : void {
    $content = file_get_contents($this->filePath);
    $this->assertIsString($content);
    $current_dictionary = explode("\n", rtrim($content));
    $this->assertIsArray($current_dictionary);
    $sorted_dictionary = $current_dictionary;
    sort($current_dictionary);
    $this->assertSame($current_dictionary, $sorted_dictionary);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.