function UserAgentTest::testGetBestMatchingLangcode

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::testGetBestMatchingLangcode()
  2. 8.9.x core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::testGetBestMatchingLangcode()
  3. 11.x core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php \Drupal\Tests\Component\Utility\UserAgentTest::testGetBestMatchingLangcode()

Tests matching language from user agent.

@dataProvider providerTestGetBestMatchingLangcode @covers ::getBestMatchingLangcode

File

core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php, line 77

Class

UserAgentTest
Tests bytes size parsing helper methods.

Namespace

Drupal\Tests\Component\Utility

Code

public function testGetBestMatchingLangcode($accept_language, $expected) : void {
    $result = UserAgent::getBestMatchingLangcode($accept_language, $this->getLanguages(), $this->getMappings());
    $this->assertSame($expected, $result);
}

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