X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FUserAgentTest.php;fp=web%2Fcore%2Ftests%2FDrupal%2FTests%2FComponent%2FUtility%2FUserAgentTest.php;h=f18d071df1d5df718e53c8a3e40b71259cb98adf;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=d804e1aab37677d6da7d41c77a233673023ac62d;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php b/web/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php index d804e1aab..f18d071df 100644 --- a/web/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php +++ b/web/core/tests/Drupal/Tests/Component/Utility/UserAgentTest.php @@ -2,8 +2,9 @@ namespace Drupal\Tests\Component\Utility; +use Drupal\Component\Utility\Random; use Drupal\Component\Utility\UserAgent; -use Drupal\Tests\UnitTestCase; +use PHPUnit\Framework\TestCase; /** * Tests bytes size parsing helper methods. @@ -12,7 +13,7 @@ use Drupal\Tests\UnitTestCase; * * @coversDefaultClass \Drupal\Component\Utility\UserAgent */ -class UserAgentTest extends UnitTestCase { +class UserAgentTest extends TestCase { /** * Helper method to supply language codes to testGetBestMatchingLangcode(). @@ -82,6 +83,9 @@ class UserAgentTest extends UnitTestCase { * - Expected best matching language code. */ public function providerTestGetBestMatchingLangcode() { + // Random generator. + $random = new Random(); + return [ // Equal qvalue for each language, choose the site preferred one. ['en,en-US,fr-CA,fr,es-MX', 'en'], @@ -141,7 +145,7 @@ class UserAgentTest extends UnitTestCase { ['', FALSE], ['de,pl', FALSE], ['iecRswK4eh', FALSE], - [$this->randomMachineName(10), FALSE], + [$random->name(10, TRUE), FALSE], // Chinese langcodes. ['zh-cn, en-us;q=0.90, en;q=0.80, zh;q=0.70', 'zh-hans'],