localizationService = static::getContainer()->get(LocalizationService::class); } public function testThrowsUnknownLanguageException() { $this->expectException(\Exception::class); $this->localizationService->getLanguage('nq;q=0.5'); } public function testThrowsUnknownLanguageExceptionInTagList() { $this->expectException(\Exception::class); $this->localizationService->getLanguages('fr-FR, nq;q=0.5'); } public function testGetsFirstLanguageFromTags() { $language = $this->localizationService->getLanguage(self::TAGS); $this->assertEquals('es', $language); } public function testReturnsDefaultLocale() { $this->assertEquals( $this->localizationService->getDefaultLanguage(), $this->localizationService->getLanguage('') ); } public function testGetsLanguagesFromTags() { $languages = $this->localizationService->getLanguages(self::TAGS); $this->assertIsArray($languages); $this->assertCount(4, $languages); $this->assertEquals('es', $languages[0]); $this->assertEquals('es', $languages[1]); $this->assertEquals('en', $languages[2]); $this->assertEquals('de', $languages[3]); } }