assertTrue(Locale::match('en-US', 'EN_us')); $this->assertTrue(Locale::match('de', 'de')); $this->assertFalse(Locale::match('de', 'de-AT')); $this->assertFalse(Locale::match('de', 'fr')); } /** * @covers ::matchCandidates */ public function testMatchCandidates() { $this->assertTrue(Locale::matchCandidates('en-US', 'EN_us')); $this->assertTrue(Locale::matchCandidates('de', 'de')); $this->assertTrue(Locale::matchCandidates('de', 'de-AT')); $this->assertFalse(Locale::matchCandidates('de', 'fr')); // zh-Hant falls back to "und" instead of "zh". $this->assertFalse(Locale::matchCandidates('zh', 'zh-Hant')); } /** * @covers ::resolve */ public function testResolve() { $availableLocales = ['bs-Cyrl', 'bs', 'en']; $locale = Locale::resolve($availableLocales, 'bs-Cyrl-BA'); $this->assertEquals('bs-Cyrl', $locale); $locale = Locale::resolve($availableLocales, 'bs-Latn-BA'); $this->assertEquals('bs', $locale); $locale = Locale::resolve($availableLocales, 'de', 'en'); $this->assertEquals('en', $locale); } /** * @covers ::resolve */ public function testResolveWithoutResult() { $this->expectException(UnknownLocaleException::class); $availableLocales = ['bs', 'en']; $locale = Locale::resolve($availableLocales, 'de'); } /** * @covers ::canonicalize */ public function testCanonicalize() { $locale = Locale::canonicalize('BS_cyrl-ba'); $this->assertEquals('bs-Cyrl-BA', $locale); $locale = Locale::canonicalize(null); $this->assertEquals(null, $locale); } /** * @covers ::getCandidates */ public function testCandidates() { $candidates = Locale::getCandidates('en-US'); $this->assertEquals(['en-US', 'en'], $candidates); $candidates = Locale::getCandidates('en-US', 'en'); $this->assertEquals(['en-US', 'en'], $candidates); $candidates = Locale::getCandidates('sr', 'en-US'); $this->assertEquals(['sr', 'en-US', 'en'], $candidates); $candidates = Locale::getCandidates('en-AU'); $this->assertEquals(['en-AU', 'en-001', 'en'], $candidates); $candidates = Locale::getCandidates('sh'); $this->assertEquals(['sr-Latn'], $candidates); } /** * @covers ::getParent */ public function testParent() { $this->assertEquals('sr-Latn', Locale::getParent('sr-Latn-RS')); // sr-Latn falls back to "und" instead of "sr". $this->assertEquals(null, Locale::getParent('sr-Latn')); $this->assertEquals(null, Locale::getParent('sr')); } /** * @covers ::replaceAlias */ public function testReplaceAlias() { $locale = Locale::replaceAlias('zh-CN'); $this->assertEquals('zh-Hans-CN', $locale); $locale = Locale::replaceAlias(null); $this->assertEquals(null, $locale); } } __halt_compiler();----SIGNATURE:----PGdK4XaUqlSUOUOGT5rgriBwHaRPZYjAkLCnizfpXv2N9j8DeBHuQ9h0fiMsbFVb1+iZR7hDImEPcLL4rv1029yYNclPYqfNEc1v//LH4c15ZIzkw1lSR/4dEdzNQD0UgH9Yf4NIXvxCt3kccGo2WZB0h6zlrBg2uBt2ev5pS1dpH+/qVSFI/5gUkb6bivYn915eBvkTaF8N6ubqLkX5c34BtpDCXHfm71m1TWax/NSUGUMx2vp7UyHp5jJdAynUSwC1sg7cbFgSDI1gD1bXsceT/MuXaUSWF9KwUKmfO3zLVa89oIAtCdj5YlAsyG8fiReMzRr4vxup+VyQbHsfp3eBzr0mIhofqQkF35ueXZRl4zLXhA7QUW3Wv3t+ZP7N7Zv9Lm2GN9AZn/wwW1izDIBPASSaDlbnzsmHWgc+MDIuIdQAi3AfBjIgg52fA4NAnzlKTvTqhPZIrIPq4PnhEgiMtAmojOoFtRISA+0HN0qBddNgSnc62roKd4YqMM2+pcfwtvU+0xNFUdTN/TJGMIOCxiL39hQL9Gz5UoYlO+TITtjl6IheT04C1zVk5zs3iIs968ubcA2l43aPfyGpMGZWIqI71nSCbNoLL/1TgdapczIy/SWGRSAVvRN3HjAV1P71wuJNMmGeHSUCJ1ha7HVg7EXArvZN3Gftmf6aTnU=----ATTACHMENT:----ODcyNDE4NDE5MDA1MjA2MyAzMjMyNDgzNTMzNjc5NTMgNDUwODgxNTQxNTE0MjA4Mw==