File: CountryListTest.php

package info (click to toggle)
php-giggsey-locale 2.8.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,160 kB
  • sloc: php: 53,967; xml: 61; makefile: 37
file content (41 lines) | stat: -rw-r--r-- 1,118 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php

declare(strict_types=1);

namespace Giggsey\Locale\Tests;

use Giggsey\Locale\Locale;
use PHPUnit\Framework\TestCase;

class CountryListTest extends TestCase
{
    public function testCountryListForEn(): void
    {
        $countryList = Locale::getAllCountriesForLocale('en');

        $this->assertIsArray($countryList);

        $this->assertArrayHasKey('GB', $countryList);
        $this->assertSame('United Kingdom', $countryList['GB']);
    }

    public function testCountryListInheriting(): void
    {
        $countryList = Locale::getAllCountriesForLocale('es-bz');

        $this->assertIsArray($countryList);

        $this->assertArrayHasKey('TA', $countryList);
        $this->assertSame('Tristán de Acuña', $countryList['TA']);

        $this->assertArrayHasKey('GB', $countryList);
        $this->assertSame('Reino Unido', $countryList['GB']);
    }

    public function testCountryListForInvalidLocale(): void
    {
        $this->expectException('RuntimeException');
        $this->expectExceptionMessage('Locale is not supported');
        Locale::getAllCountriesForLocale('fake');
    }
}