function LanguageUnitTest::testSortArrayOfLanguages

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php \Drupal\Tests\Core\Language\LanguageUnitTest::testSortArrayOfLanguages()
  2. 8.9.x core/tests/Drupal/Tests/Core/Language/LanguageUnitTest.php \Drupal\Tests\Core\Language\LanguageUnitTest::testSortArrayOfLanguages()
  3. 10 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 97

Class

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

Namespace

Drupal\Tests\Core\Language

Code

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

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