aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php
diff options
context:
space:
mode:
authorNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
committerNicolas Lœuillet <nicolas.loeuillet@gmail.com>2013-08-03 19:26:54 +0200
commit4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch)
tree6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php
parent2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff)
downloadwallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst
wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip
twig implementation
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php')
-rw-r--r--vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php98
1 files changed, 98 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php
new file mode 100644
index 00000000..b66a6727
--- /dev/null
+++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/CurrencyBundleTest.php
@@ -0,0 +1,98 @@
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
12namespace Symfony\Component\Intl\Tests\ResourceBundle;
13
14use Symfony\Component\Intl\ResourceBundle\CurrencyBundle;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class CurrencyBundleTest extends \PHPUnit_Framework_TestCase
20{
21 const RES_DIR = '/base/curr';
22
23 /**
24 * @var CurrencyBundle
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 CurrencyBundle(self::RES_DIR, $this->reader);
37 }
38
39 public function testGetCurrencySymbol()
40 {
41 $this->reader->expects($this->once())
42 ->method('readEntry')
43 ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 1))
44 ->will($this->returnValue('€'));
45
46 $this->assertSame('€', $this->bundle->getCurrencySymbol('EUR', 'en'));
47 }
48
49 public function testGetCurrencyName()
50 {
51 $this->reader->expects($this->once())
52 ->method('readEntry')
53 ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 0))
54 ->will($this->returnValue('Euro'));
55
56 $this->assertSame('Euro', $this->bundle->getCurrencyName('EUR', 'en'));
57 }
58
59 public function testGetCurrencyNames()
60 {
61 $sortedCurrencies = array(
62 'USD' => array(0 => 'Dollar'),
63 'EUR' => array(0 => 'Euro'),
64 );
65
66 $this->reader->expects($this->once())
67 ->method('readEntry')
68 ->with(self::RES_DIR, 'en', array('Currencies'))
69 ->will($this->returnValue($sortedCurrencies));
70
71 $sortedNames = array(
72 'USD' => 'Dollar',
73 'EUR' => 'Euro',
74 );
75
76 $this->assertSame($sortedNames, $this->bundle->getCurrencyNames('en'));
77 }
78
79 public function testGetFractionDigits()
80 {
81 $this->reader->expects($this->once())
82 ->method('readEntry')
83 ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 2))
84 ->will($this->returnValue(123));
85
86 $this->assertSame(123, $this->bundle->getFractionDigits('EUR'));
87 }
88
89 public function testGetRoundingIncrement()
90 {
91 $this->reader->expects($this->once())
92 ->method('readEntry')
93 ->with(self::RES_DIR, 'en', array('Currencies', 'EUR', 3))
94 ->will($this->returnValue(123));
95
96 $this->assertSame(123, $this->bundle->getRoundingIncrement('EUR'));
97 }
98}