4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Intl\Tests\ResourceBundle
;
14 use Symfony\Component\Intl\ResourceBundle\LocaleBundle
;
17 * @author Bernhard Schussek <bschussek@gmail.com>
19 class LocaleBundleTest
extends \PHPUnit_Framework_TestCase
21 const RES_DIR
= '/base/locales';
29 * @var \PHPUnit_Framework_MockObject_MockObject
33 protected function setUp()
35 $this->reader
= $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface');
36 $this->bundle
= new LocaleBundle(self
::RES_DIR
, $this->reader
);
39 public function testGetLocaleName()
41 $this->reader
->expects($this->once())
43 ->with(self
::RES_DIR
, 'en', array('Locales', 'de_AT'))
44 ->will($this->returnValue('German (Austria)'));
46 $this->assertSame('German (Austria)', $this->bundle
->getLocaleName('de_AT', 'en'));
49 public function testGetLocaleNames()
51 $sortedLocales = array(
52 'en_IE' => 'English (Ireland)',
53 'en_GB' => 'English (United Kingdom)',
54 'en_US' => 'English (United States)',
57 $this->reader
->expects($this->once())
59 ->with(self
::RES_DIR
, 'en', array('Locales'))
60 ->will($this->returnValue($sortedLocales));
62 $this->assertSame($sortedLocales, $this->bundle
->getLocaleNames('en'));