‪TYPO3CMS  ‪main
CountryTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
23 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
24 
25 final class ‪CountryTest extends FunctionalTestCase
26 {
27  #[Test]
28  public function ‪countryLabelCanBeLocalized(): void
29  {
30  $languageServiceFactory = $this->get(LanguageServiceFactory::class);
31  $languageService = $languageServiceFactory->create('de');
32  $provider = $this->get('country.provider');
33  $subject = $provider->getByIsoCode('FR');
34  self::assertInstanceOf(Country::class, $subject);
35  self::assertEquals('France', $languageService->sL($subject->getName()));
36  self::assertEquals('Frankreich', $languageService->sL($subject->getLocalizedNameLabel()));
37  self::assertEquals('Französische Republik', $languageService->sL($subject->getLocalizedOfficialNameLabel()));
38 
39  $subject = $provider->getByIsoCode('BEL');
40  $languageService = $languageServiceFactory->create('fr');
41  self::assertEquals('Belgique', $languageService->sL($subject->getLocalizedNameLabel()));
42  self::assertEquals('Royaume de Belgique', $languageService->sL($subject->getLocalizedOfficialNameLabel()));
43  self::assertEquals('Kingdom of Belgium', $subject->getOfficialName());
44  self::assertEquals('Kingdom of Belgium', $languageService->sL($subject->getOfficialName()));
45  }
46 }
‪TYPO3\CMS\Core\Localization\LanguageServiceFactory
Definition: LanguageServiceFactory.php:25
‪TYPO3\CMS\Core\Tests\Functional\Country\CountryTest
Definition: CountryTest.php:26
‪TYPO3\CMS\Core\Country\Country
Definition: Country.php:25
‪TYPO3\CMS\Core\Tests\Functional\Country
Definition: CountryTest.php:18
‪TYPO3\CMS\Core\Tests\Functional\Country\CountryTest\countryLabelCanBeLocalized
‪countryLabelCanBeLocalized()
Definition: CountryTest.php:28