]> git.immae.eu Git - github/wallabag/wallabag.git/blob - vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php
gitignore vendor
[github/wallabag/wallabag.git] / vendor / symfony / intl / Symfony / Component / Intl / Tests / ResourceBundle / LocaleBundleTest.php
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Symfony\Component\Intl\Tests\ResourceBundle;
13
14 use Symfony\Component\Intl\ResourceBundle\LocaleBundle;
15
16 /**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19 class LocaleBundleTest extends \PHPUnit_Framework_TestCase
20 {
21 const RES_DIR = '/base/locales';
22
23 /**
24 * @var LocaleBundle
25 */
26 private $bundle;
27
28 /**
29 * @var \PHPUnit_Framework_MockObject_MockObject
30 */
31 private $reader;
32
33 protected function setUp()
34 {
35 $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface');
36 $this->bundle = new LocaleBundle(self::RES_DIR, $this->reader);
37 }
38
39 public function testGetLocaleName()
40 {
41 $this->reader->expects($this->once())
42 ->method('readEntry')
43 ->with(self::RES_DIR, 'en', array('Locales', 'de_AT'))
44 ->will($this->returnValue('German (Austria)'));
45
46 $this->assertSame('German (Austria)', $this->bundle->getLocaleName('de_AT', 'en'));
47 }
48
49 public function testGetLocaleNames()
50 {
51 $sortedLocales = array(
52 'en_IE' => 'English (Ireland)',
53 'en_GB' => 'English (United Kingdom)',
54 'en_US' => 'English (United States)',
55 );
56
57 $this->reader->expects($this->once())
58 ->method('readEntry')
59 ->with(self::RES_DIR, 'en', array('Locales'))
60 ->will($this->returnValue($sortedLocales));
61
62 $this->assertSame($sortedLocales, $this->bundle->getLocaleNames('en'));
63 }
64 }