You are here

public function LanguageUnitTest::testSortArrayOfLanguages in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php \Drupal\Tests\Core\Language\LanguageUnitTest::testSortArrayOfLanguages()

Tests sorting an array of language objects.

@covers ::sort

@dataProvider providerTestSortArrayOfLanguages

Parameters

\Drupal\Core\Language\LanguageInterface[] $languages: An array of language objects.

array $expected: The expected array of keys.

File

core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php, line 95

Class

LanguageUnitTest
@coversDefaultClass \Drupal\Core\Language\Language @group Language

Namespace

Drupal\Tests\Core\Language

Code

public function testSortArrayOfLanguages(array $languages, array $expected) {
  Language::sort($languages);
  $this
    ->assertSame($expected, array_keys($languages));
}