From 4f5b44bd3bd490309eb2ba7b44df4769816ba729 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sat, 3 Aug 2013 19:26:54 +0200 Subject: twig implementation --- .../Intl/Tests/ResourceBundle/LocaleBundleTest.php | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php') diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php new file mode 100644 index 00000000..ddfdc3d2 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LocaleBundleTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Intl\Tests\ResourceBundle; + +use Symfony\Component\Intl\ResourceBundle\LocaleBundle; + +/** + * @author Bernhard Schussek + */ +class LocaleBundleTest extends \PHPUnit_Framework_TestCase +{ + const RES_DIR = '/base/locales'; + + /** + * @var LocaleBundle + */ + private $bundle; + + /** + * @var \PHPUnit_Framework_MockObject_MockObject + */ + private $reader; + + protected function setUp() + { + $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); + $this->bundle = new LocaleBundle(self::RES_DIR, $this->reader); + } + + public function testGetLocaleName() + { + $this->reader->expects($this->once()) + ->method('readEntry') + ->with(self::RES_DIR, 'en', array('Locales', 'de_AT')) + ->will($this->returnValue('German (Austria)')); + + $this->assertSame('German (Austria)', $this->bundle->getLocaleName('de_AT', 'en')); + } + + public function testGetLocaleNames() + { + $sortedLocales = array( + 'en_IE' => 'English (Ireland)', + 'en_GB' => 'English (United Kingdom)', + 'en_US' => 'English (United States)', + ); + + $this->reader->expects($this->once()) + ->method('readEntry') + ->with(self::RES_DIR, 'en', array('Locales')) + ->will($this->returnValue($sortedLocales)); + + $this->assertSame($sortedLocales, $this->bundle->getLocaleNames('en')); + } +} -- cgit v1.2.3