class SortTest

Same name in this branch
  1. 11.x core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest
  2. 11.x core/modules/views/tests/src/Kernel/Handler/SortTest.php \Drupal\Tests\views\Kernel\Handler\SortTest
  3. 11.x core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest
Same name in other branches
  1. 9 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest
  2. 9 core/modules/views/tests/src/Kernel/Handler/SortTest.php \Drupal\Tests\views\Kernel\Handler\SortTest
  3. 9 core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest
  4. 8.9.x core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest
  5. 8.9.x core/modules/views/tests/src/Kernel/Handler/SortTest.php \Drupal\Tests\views\Kernel\Handler\SortTest
  6. 10 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php \Drupal\Tests\jsonapi\Unit\Query\SortTest
  7. 10 core/modules/views/tests/src/Kernel/Handler/SortTest.php \Drupal\Tests\views\Kernel\Handler\SortTest
  8. 10 core/tests/Drupal/Tests/PhpCs/SortTest.php \Drupal\Tests\PhpCs\SortTest
  9. 10 core/tests/Drupal/Tests/CSpell/SortTest.php \Drupal\Tests\CSpell\SortTest

Tests that the dictionary.txt file is properly sorted.

@group cspell

Hierarchy

  • class \Drupal\Tests\CSpell\SortTest extends \PHPUnit\Framework\TestCase

Expanded class hierarchy of SortTest

File

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

Namespace

Drupal\Tests\CSpell
View source
class SortTest extends TestCase {
    
    /**
     * The path to the dictionary file.
     */
    private string $filePath;
    
    /**
     * {@inheritdoc}
     */
    protected function setUp() : void {
        $this->filePath = dirname(__DIR__, 5) . '/core/misc/cspell/dictionary.txt';
    }
    
    /**
     * Tests that the file exists.
     */
    public function testFileExists() : void {
        $this->assertFileExists($this->filePath);
    }
    
    /**
     * Tests that the file is properly sorted.
     */
    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);
    }

}

Members

Title Sort descending Modifiers Object type Summary
SortTest::$filePath private property The path to the dictionary file.
SortTest::setUp protected function
SortTest::testFileExists public function Tests that the file exists.
SortTest::testSorted public function Tests that the file is properly sorted.

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