SortTest.php
Same filename in this branch
Same filename in other branches
- 9 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php
- 9 core/modules/views/tests/src/Kernel/Handler/SortTest.php
- 9 core/tests/Drupal/Tests/PhpCs/SortTest.php
- 8.9.x core/modules/jsonapi/tests/src/Unit/Query/SortTest.php
- 8.9.x core/modules/views/tests/src/Kernel/Handler/SortTest.php
- 10 core/modules/jsonapi/tests/src/Unit/Query/SortTest.php
- 10 core/modules/views/tests/src/Kernel/Handler/SortTest.php
- 10 core/tests/Drupal/Tests/PhpCs/SortTest.php
- 10 core/tests/Drupal/Tests/CSpell/SortTest.php
Namespace
Drupal\Tests\CSpellFile
-
core/
tests/ Drupal/ Tests/ CSpell/ SortTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\CSpell;
use PHPUnit\Framework\TestCase;
/**
* Tests that the dictionary.txt file is properly sorted.
*
* @group cspell
*/
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);
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
SortTest | Tests that the dictionary.txt file is properly sorted. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.