aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/icu/Symfony/Component/Icu/Tests/IcuIntegrationTest.php
blob: 9fb65af322159994b6f5422a4dee324bacd68e5f (plain) (blame)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Icu\Tests;

use Symfony\Component\Icu\IcuCurrencyBundle;
use Symfony\Component\Icu\IcuLanguageBundle;
use Symfony\Component\Icu\IcuLocaleBundle;
use Symfony\Component\Icu\IcuRegionBundle;
use Symfony\Component\Intl\ResourceBundle\Reader\PhpBundleReader;
use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReader;

/**
 * Verifies that the data files can actually be read.
 *
 * @author Bernhard Schussek <bschussek@gmail.com>
 */
class IcuIntegrationTest extends \PHPUnit_Framework_TestCase
{
    public function testCurrencyBundle()
    {
        $bundle = new IcuCurrencyBundle(new StructuredBundleReader(new PhpBundleReader()));

        $this->assertSame('€', $bundle->getCurrencySymbol('EUR', 'en'));
    }

    public function testLanguageBundle()
    {
        $bundle = new IcuLanguageBundle(new StructuredBundleReader(new PhpBundleReader()));

        $this->assertSame('German', $bundle->getLanguageName('de', null, 'en'));
    }

    public function testLocaleBundle()
    {
        $bundle = new IcuLocaleBundle(new StructuredBundleReader(new PhpBundleReader()));

        $this->assertSame('Azerbaijani', $bundle->getLocaleName('az', 'en'));
    }

    public function testRegionBundle()
    {
        $bundle = new IcuRegionBundle(new StructuredBundleReader(new PhpBundleReader()));

        $this->assertSame('United Kingdom', $bundle->getCountryName('GB', 'en'));
    }
}