diff options
author | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas.loeuillet@gmail.com> | 2013-08-03 19:26:54 +0200 |
commit | 4f5b44bd3bd490309eb2ba7b44df4769816ba729 (patch) | |
tree | 6cefe170dfe0a5a361cb1e2d1fc4d580a3316d02 /vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle | |
parent | 2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff) | |
download | wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip |
twig implementation
Diffstat (limited to 'vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle')
19 files changed, 1178 insertions, 0 deletions
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php new file mode 100644 index 00000000..6b075865 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/AbstractBundleTest.php | |||
@@ -0,0 +1,55 @@ | |||
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 | /** | ||
15 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
16 | */ | ||
17 | class AbstractBundleTest extends \PHPUnit_Framework_TestCase | ||
18 | { | ||
19 | const RES_DIR = '/base/dirName'; | ||
20 | |||
21 | /** | ||
22 | * @var \Symfony\Component\Intl\ResourceBundle\AbstractBundle | ||
23 | */ | ||
24 | private $bundle; | ||
25 | |||
26 | /** | ||
27 | * @var \PHPUnit_Framework_MockObject_MockObject | ||
28 | */ | ||
29 | private $reader; | ||
30 | |||
31 | protected function setUp() | ||
32 | { | ||
33 | $this->reader = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); | ||
34 | $this->bundle = $this->getMockForAbstractClass( | ||
35 | 'Symfony\Component\Intl\ResourceBundle\AbstractBundle', | ||
36 | array(self::RES_DIR, $this->reader) | ||
37 | ); | ||
38 | |||
39 | $this->bundle->expects($this->any()) | ||
40 | ->method('getDirectoryName') | ||
41 | ->will($this->returnValue('dirName')); | ||
42 | } | ||
43 | |||
44 | public function testGetLocales() | ||
45 | { | ||
46 | $locales = array('de', 'en', 'fr'); | ||
47 | |||
48 | $this->reader->expects($this->once()) | ||
49 | ->method('getLocales') | ||
50 | ->with(self::RES_DIR) | ||
51 | ->will($this->returnValue($locales)); | ||
52 | |||
53 | $this->assertSame($locales, $this->bundle->getLocales()); | ||
54 | } | ||
55 | } | ||
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 | |||
12 | namespace Symfony\Component\Intl\Tests\ResourceBundle; | ||
13 | |||
14 | use Symfony\Component\Intl\ResourceBundle\CurrencyBundle; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class 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 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php new file mode 100644 index 00000000..96031fc7 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/LanguageBundleTest.php | |||
@@ -0,0 +1,197 @@ | |||
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\LanguageBundle; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class LanguageBundleTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | const RES_DIR = '/base/lang'; | ||
22 | |||
23 | /** | ||
24 | * @var LanguageBundle | ||
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 LanguageBundle(self::RES_DIR, $this->reader); | ||
37 | } | ||
38 | |||
39 | public function testGetLanguageName() | ||
40 | { | ||
41 | $languages = array( | ||
42 | 'de' => 'German', | ||
43 | 'en' => 'English', | ||
44 | ); | ||
45 | |||
46 | $this->reader->expects($this->once()) | ||
47 | ->method('readEntry') | ||
48 | ->with(self::RES_DIR, 'en', array('Languages')) | ||
49 | ->will($this->returnValue($languages)); | ||
50 | |||
51 | $this->assertSame('German', $this->bundle->getLanguageName('de', null, 'en')); | ||
52 | } | ||
53 | |||
54 | public function testGetLanguageNameWithRegion() | ||
55 | { | ||
56 | $languages = array( | ||
57 | 'de' => 'German', | ||
58 | 'en' => 'English', | ||
59 | 'en_GB' => 'British English', | ||
60 | ); | ||
61 | |||
62 | $this->reader->expects($this->once()) | ||
63 | ->method('readEntry') | ||
64 | ->with(self::RES_DIR, 'en', array('Languages')) | ||
65 | ->will($this->returnValue($languages)); | ||
66 | |||
67 | $this->assertSame('British English', $this->bundle->getLanguageName('en', 'GB', 'en')); | ||
68 | } | ||
69 | |||
70 | public function testGetLanguageNameWithUntranslatedRegion() | ||
71 | { | ||
72 | $languages = array( | ||
73 | 'de' => 'German', | ||
74 | 'en' => 'English', | ||
75 | ); | ||
76 | |||
77 | $this->reader->expects($this->once()) | ||
78 | ->method('readEntry') | ||
79 | ->with(self::RES_DIR, 'en', array('Languages')) | ||
80 | ->will($this->returnValue($languages)); | ||
81 | |||
82 | $this->assertSame('English', $this->bundle->getLanguageName('en', 'US', 'en')); | ||
83 | } | ||
84 | |||
85 | public function testGetLanguageNames() | ||
86 | { | ||
87 | $sortedLanguages = array( | ||
88 | 'en' => 'English', | ||
89 | 'de' => 'German', | ||
90 | ); | ||
91 | |||
92 | $this->reader->expects($this->once()) | ||
93 | ->method('readEntry') | ||
94 | ->with(self::RES_DIR, 'en', array('Languages')) | ||
95 | ->will($this->returnValue($sortedLanguages)); | ||
96 | |||
97 | $this->assertSame($sortedLanguages, $this->bundle->getLanguageNames('en')); | ||
98 | } | ||
99 | |||
100 | public function testGetScriptName() | ||
101 | { | ||
102 | $data = array( | ||
103 | 'Languages' => array( | ||
104 | 'de' => 'German', | ||
105 | 'en' => 'English', | ||
106 | ), | ||
107 | 'Scripts' => array( | ||
108 | 'Latn' => 'latin', | ||
109 | 'Cyrl' => 'cyrillique', | ||
110 | ), | ||
111 | ); | ||
112 | |||
113 | $this->reader->expects($this->once()) | ||
114 | ->method('read') | ||
115 | ->with(self::RES_DIR, 'en') | ||
116 | ->will($this->returnValue($data)); | ||
117 | |||
118 | $this->assertSame('latin', $this->bundle->getScriptName('Latn', null, 'en')); | ||
119 | } | ||
120 | |||
121 | public function testGetScriptNameIncludedInLanguage() | ||
122 | { | ||
123 | $data = array( | ||
124 | 'Languages' => array( | ||
125 | 'de' => 'German', | ||
126 | 'en' => 'English', | ||
127 | 'zh_Hans' => 'Simplified Chinese', | ||
128 | ), | ||
129 | 'Scripts' => array( | ||
130 | 'Latn' => 'latin', | ||
131 | 'Cyrl' => 'cyrillique', | ||
132 | ), | ||
133 | ); | ||
134 | |||
135 | $this->reader->expects($this->once()) | ||
136 | ->method('read') | ||
137 | ->with(self::RES_DIR, 'en') | ||
138 | ->will($this->returnValue($data)); | ||
139 | |||
140 | // Null because the script is included in the language anyway | ||
141 | $this->assertNull($this->bundle->getScriptName('Hans', 'zh', 'en')); | ||
142 | } | ||
143 | |||
144 | public function testGetScriptNameIncludedInLanguageInBraces() | ||
145 | { | ||
146 | $data = array( | ||
147 | 'Languages' => array( | ||
148 | 'de' => 'German', | ||
149 | 'en' => 'English', | ||
150 | 'zh_Hans' => 'Chinese (simplified)', | ||
151 | ), | ||
152 | 'Scripts' => array( | ||
153 | 'Latn' => 'latin', | ||
154 | 'Cyrl' => 'cyrillique', | ||
155 | ), | ||
156 | ); | ||
157 | |||
158 | $this->reader->expects($this->once()) | ||
159 | ->method('read') | ||
160 | ->with(self::RES_DIR, 'en') | ||
161 | ->will($this->returnValue($data)); | ||
162 | |||
163 | $this->assertSame('simplified', $this->bundle->getScriptName('Hans', 'zh', 'en')); | ||
164 | } | ||
165 | |||
166 | public function testGetScriptNameNoScriptsBlock() | ||
167 | { | ||
168 | $data = array( | ||
169 | 'Languages' => array( | ||
170 | 'de' => 'German', | ||
171 | 'en' => 'English', | ||
172 | ), | ||
173 | ); | ||
174 | |||
175 | $this->reader->expects($this->once()) | ||
176 | ->method('read') | ||
177 | ->with(self::RES_DIR, 'en') | ||
178 | ->will($this->returnValue($data)); | ||
179 | |||
180 | $this->assertNull($this->bundle->getScriptName('Latn', null, 'en')); | ||
181 | } | ||
182 | |||
183 | public function testGetScriptNames() | ||
184 | { | ||
185 | $sortedScripts = array( | ||
186 | 'Cyrl' => 'cyrillique', | ||
187 | 'Latn' => 'latin', | ||
188 | ); | ||
189 | |||
190 | $this->reader->expects($this->once()) | ||
191 | ->method('readEntry') | ||
192 | ->with(self::RES_DIR, 'en', array('Scripts')) | ||
193 | ->will($this->returnValue($sortedScripts)); | ||
194 | |||
195 | $this->assertSame($sortedScripts, $this->bundle->getScriptNames('en')); | ||
196 | } | ||
197 | } | ||
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 @@ | |||
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 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php new file mode 100644 index 00000000..2da7f90d --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/AbstractBundleReaderTest.php | |||
@@ -0,0 +1,64 @@ | |||
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\Reader; | ||
13 | |||
14 | use Symfony\Component\Filesystem\Filesystem; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class AbstractBundleReaderTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | private $directory; | ||
22 | |||
23 | /** | ||
24 | * @var Filesystem | ||
25 | */ | ||
26 | private $filesystem; | ||
27 | |||
28 | /** | ||
29 | * @var \PHPUnit_Framework_MockObject_MockObject | ||
30 | */ | ||
31 | private $reader; | ||
32 | |||
33 | protected function setUp() | ||
34 | { | ||
35 | $this->directory = sys_get_temp_dir() . '/AbstractBundleReaderTest/' . rand(1000, 9999); | ||
36 | $this->filesystem = new Filesystem(); | ||
37 | $this->reader = $this->getMockForAbstractClass('Symfony\Component\Intl\ResourceBundle\Reader\AbstractBundleReader'); | ||
38 | |||
39 | $this->filesystem->mkdir($this->directory); | ||
40 | } | ||
41 | |||
42 | protected function tearDown() | ||
43 | { | ||
44 | $this->filesystem->remove($this->directory); | ||
45 | } | ||
46 | |||
47 | public function testGetLocales() | ||
48 | { | ||
49 | $this->filesystem->touch($this->directory . '/en.foo'); | ||
50 | $this->filesystem->touch($this->directory . '/de.foo'); | ||
51 | $this->filesystem->touch($this->directory . '/fr.foo'); | ||
52 | $this->filesystem->touch($this->directory . '/bo.txt'); | ||
53 | $this->filesystem->touch($this->directory . '/gu.bin'); | ||
54 | $this->filesystem->touch($this->directory . '/s.lol'); | ||
55 | |||
56 | $this->reader->expects($this->any()) | ||
57 | ->method('getFileExtension') | ||
58 | ->will($this->returnValue('foo')); | ||
59 | |||
60 | $sortedLocales = array('de', 'en', 'fr'); | ||
61 | |||
62 | $this->assertSame($sortedLocales, $this->reader->getLocales($this->directory)); | ||
63 | } | ||
64 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php new file mode 100644 index 00000000..3aefbae7 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/BinaryBundleReaderTest.php | |||
@@ -0,0 +1,58 @@ | |||
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\Reader; | ||
13 | |||
14 | use Symfony\Component\Intl\ResourceBundle\Reader\BinaryBundleReader; | ||
15 | use Symfony\Component\Intl\Util\IntlTestHelper; | ||
16 | |||
17 | /** | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | */ | ||
20 | class BinaryBundleReaderTest extends \PHPUnit_Framework_TestCase | ||
21 | { | ||
22 | /** | ||
23 | * @var BinaryBundleReader | ||
24 | */ | ||
25 | private $reader; | ||
26 | |||
27 | protected function setUp() | ||
28 | { | ||
29 | IntlTestHelper::requireFullIntl($this); | ||
30 | |||
31 | $this->reader = new BinaryBundleReader(); | ||
32 | } | ||
33 | |||
34 | public function testReadReturnsArrayAccess() | ||
35 | { | ||
36 | $data = $this->reader->read(__DIR__ . '/Fixtures', 'en'); | ||
37 | |||
38 | $this->assertInstanceOf('\ArrayAccess', $data); | ||
39 | $this->assertSame('Bar', $data['Foo']); | ||
40 | $this->assertFalse(isset($data['ExistsNot'])); | ||
41 | } | ||
42 | |||
43 | /** | ||
44 | * @expectedException \Symfony\Component\Intl\Exception\RuntimeException | ||
45 | */ | ||
46 | public function testReadFailsIfNonExistingLocale() | ||
47 | { | ||
48 | $this->reader->read(__DIR__ . '/Fixtures', 'foo'); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * @expectedException \Symfony\Component\Intl\Exception\RuntimeException | ||
53 | */ | ||
54 | public function testReadFailsIfNonExistingDirectory() | ||
55 | { | ||
56 | $this->reader->read(__DIR__ . '/foo', 'en'); | ||
57 | } | ||
58 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/NotAFile/en.php/.gitkeep | |||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php new file mode 100644 index 00000000..f2b06a91 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.php | |||
@@ -0,0 +1,14 @@ | |||
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 | return array( | ||
13 | 'Foo' => 'Bar', | ||
14 | ); | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res new file mode 100644 index 00000000..c78e9045 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.res | |||
Binary files differ | |||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt new file mode 100644 index 00000000..c788e996 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/Fixtures/en.txt | |||
@@ -0,0 +1,3 @@ | |||
1 | en{ | ||
2 | Foo{"Bar"} | ||
3 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php new file mode 100644 index 00000000..2fee3559 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/PhpBundleReaderTest.php | |||
@@ -0,0 +1,63 @@ | |||
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\Reader; | ||
13 | |||
14 | use Symfony\Component\Intl\ResourceBundle\Reader\PhpBundleReader; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class PhpBundleReaderTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | /** | ||
22 | * @var PhpBundleReader | ||
23 | */ | ||
24 | private $reader; | ||
25 | |||
26 | protected function setUp() | ||
27 | { | ||
28 | $this->reader = new PhpBundleReader(); | ||
29 | } | ||
30 | |||
31 | public function testReadReturnsArray() | ||
32 | { | ||
33 | $data = $this->reader->read(__DIR__ . '/Fixtures', 'en'); | ||
34 | |||
35 | $this->assertTrue(is_array($data)); | ||
36 | $this->assertSame('Bar', $data['Foo']); | ||
37 | $this->assertFalse(isset($data['ExistsNot'])); | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | * @expectedException \Symfony\Component\Intl\Exception\InvalidArgumentException | ||
42 | */ | ||
43 | public function testReadFailsIfLocaleOtherThanEn() | ||
44 | { | ||
45 | $this->reader->read(__DIR__ . '/Fixtures', 'foo'); | ||
46 | } | ||
47 | |||
48 | /** | ||
49 | * @expectedException \Symfony\Component\Intl\Exception\RuntimeException | ||
50 | */ | ||
51 | public function testReadFailsIfNonExistingDirectory() | ||
52 | { | ||
53 | $this->reader->read(__DIR__ . '/foo', 'en'); | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * @expectedException \Symfony\Component\Intl\Exception\RuntimeException | ||
58 | */ | ||
59 | public function testReadFailsIfNotAFile() | ||
60 | { | ||
61 | $this->reader->read(__DIR__ . '/Fixtures/NotAFile', 'en'); | ||
62 | } | ||
63 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php new file mode 100644 index 00000000..600236eb --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Reader/StructuredBundleReaderTest.php | |||
@@ -0,0 +1,223 @@ | |||
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\Reader; | ||
13 | |||
14 | use Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReader; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class StructuredBundleReaderTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | const RES_DIR = '/res/dir'; | ||
22 | |||
23 | /** | ||
24 | * @var StructuredBundleReader | ||
25 | */ | ||
26 | private $reader; | ||
27 | |||
28 | /** | ||
29 | * @var \PHPUnit_Framework_MockObject_MockObject | ||
30 | */ | ||
31 | private $readerImpl; | ||
32 | |||
33 | protected function setUp() | ||
34 | { | ||
35 | $this->readerImpl = $this->getMock('Symfony\Component\Intl\ResourceBundle\Reader\StructuredBundleReaderInterface'); | ||
36 | $this->reader = new StructuredBundleReader($this->readerImpl); | ||
37 | } | ||
38 | |||
39 | public function testGetLocales() | ||
40 | { | ||
41 | $locales = array('en', 'de', 'fr'); | ||
42 | |||
43 | $this->readerImpl->expects($this->once()) | ||
44 | ->method('getLocales') | ||
45 | ->with(self::RES_DIR) | ||
46 | ->will($this->returnValue($locales)); | ||
47 | |||
48 | $this->assertSame($locales, $this->reader->getLocales(self::RES_DIR)); | ||
49 | } | ||
50 | |||
51 | public function testRead() | ||
52 | { | ||
53 | $data = array('foo', 'bar'); | ||
54 | |||
55 | $this->readerImpl->expects($this->once()) | ||
56 | ->method('read') | ||
57 | ->with(self::RES_DIR, 'en') | ||
58 | ->will($this->returnValue($data)); | ||
59 | |||
60 | $this->assertSame($data, $this->reader->read(self::RES_DIR, 'en')); | ||
61 | } | ||
62 | |||
63 | public function testReadEntryNoParams() | ||
64 | { | ||
65 | $data = array('foo', 'bar'); | ||
66 | |||
67 | $this->readerImpl->expects($this->once()) | ||
68 | ->method('read') | ||
69 | ->with(self::RES_DIR, 'en') | ||
70 | ->will($this->returnValue($data)); | ||
71 | |||
72 | $this->assertSame($data, $this->reader->readEntry(self::RES_DIR, 'en', array())); | ||
73 | } | ||
74 | |||
75 | public function testReadEntryWithParam() | ||
76 | { | ||
77 | $data = array('Foo' => array('Bar' => 'Baz')); | ||
78 | |||
79 | $this->readerImpl->expects($this->once()) | ||
80 | ->method('read') | ||
81 | ->with(self::RES_DIR, 'en') | ||
82 | ->will($this->returnValue($data)); | ||
83 | |||
84 | $this->assertSame('Baz', $this->reader->readEntry(self::RES_DIR, 'en', array('Foo', 'Bar'))); | ||
85 | } | ||
86 | |||
87 | public function testReadEntryWithUnresolvablePath() | ||
88 | { | ||
89 | $data = array('Foo' => 'Baz'); | ||
90 | |||
91 | $this->readerImpl->expects($this->once()) | ||
92 | ->method('read') | ||
93 | ->with(self::RES_DIR, 'en') | ||
94 | ->will($this->returnValue($data)); | ||
95 | |||
96 | $this->assertNull($this->reader->readEntry(self::RES_DIR, 'en', array('Foo', 'Bar'))); | ||
97 | } | ||
98 | |||
99 | public function readMergedEntryProvider() | ||
100 | { | ||
101 | return array( | ||
102 | array('foo', null, 'foo'), | ||
103 | array(null, 'foo', 'foo'), | ||
104 | array(array('foo', 'bar'), null, array('foo', 'bar')), | ||
105 | array(array('foo', 'bar'), array(), array('foo', 'bar')), | ||
106 | array(null, array('baz'), array('baz')), | ||
107 | array(array(), array('baz'), array('baz')), | ||
108 | array(array('foo', 'bar'), array('baz'), array('baz', 'foo', 'bar')), | ||
109 | ); | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * @dataProvider readMergedEntryProvider | ||
114 | */ | ||
115 | public function testReadMergedEntryNoParams($childData, $parentData, $result) | ||
116 | { | ||
117 | $this->readerImpl->expects($this->at(0)) | ||
118 | ->method('read') | ||
119 | ->with(self::RES_DIR, 'en_GB') | ||
120 | ->will($this->returnValue($childData)); | ||
121 | |||
122 | if (null === $childData || is_array($childData)) { | ||
123 | $this->readerImpl->expects($this->at(1)) | ||
124 | ->method('read') | ||
125 | ->with(self::RES_DIR, 'en') | ||
126 | ->will($this->returnValue($parentData)); | ||
127 | } | ||
128 | |||
129 | $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array(), true)); | ||
130 | } | ||
131 | |||
132 | /** | ||
133 | * @dataProvider readMergedEntryProvider | ||
134 | */ | ||
135 | public function testReadMergedEntryWithParams($childData, $parentData, $result) | ||
136 | { | ||
137 | $this->readerImpl->expects($this->at(0)) | ||
138 | ->method('read') | ||
139 | ->with(self::RES_DIR, 'en_GB') | ||
140 | ->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); | ||
141 | |||
142 | if (null === $childData || is_array($childData)) { | ||
143 | $this->readerImpl->expects($this->at(1)) | ||
144 | ->method('read') | ||
145 | ->with(self::RES_DIR, 'en') | ||
146 | ->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); | ||
147 | } | ||
148 | |||
149 | $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); | ||
150 | } | ||
151 | |||
152 | public function testReadMergedEntryWithUnresolvablePath() | ||
153 | { | ||
154 | $this->readerImpl->expects($this->at(0)) | ||
155 | ->method('read') | ||
156 | ->with(self::RES_DIR, 'en_GB') | ||
157 | ->will($this->returnValue(array('Foo' => 'Baz'))); | ||
158 | |||
159 | $this->readerImpl->expects($this->at(1)) | ||
160 | ->method('read') | ||
161 | ->with(self::RES_DIR, 'en') | ||
162 | ->will($this->returnValue(array('Foo' => 'Bar'))); | ||
163 | |||
164 | $this->assertNull($this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); | ||
165 | } | ||
166 | |||
167 | public function testReadMergedEntryWithUnresolvablePathInParent() | ||
168 | { | ||
169 | $this->readerImpl->expects($this->at(0)) | ||
170 | ->method('read') | ||
171 | ->with(self::RES_DIR, 'en_GB') | ||
172 | ->will($this->returnValue(array('Foo' => array('Bar' => array('three'))))); | ||
173 | |||
174 | $this->readerImpl->expects($this->at(1)) | ||
175 | ->method('read') | ||
176 | ->with(self::RES_DIR, 'en') | ||
177 | ->will($this->returnValue(array('Foo' => 'Bar'))); | ||
178 | |||
179 | $result = array('three'); | ||
180 | |||
181 | $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); | ||
182 | } | ||
183 | |||
184 | public function testReadMergedEntryWithUnresolvablePathInChild() | ||
185 | { | ||
186 | $this->readerImpl->expects($this->at(0)) | ||
187 | ->method('read') | ||
188 | ->with(self::RES_DIR, 'en_GB') | ||
189 | ->will($this->returnValue(array('Foo' => 'Baz'))); | ||
190 | |||
191 | $this->readerImpl->expects($this->at(1)) | ||
192 | ->method('read') | ||
193 | ->with(self::RES_DIR, 'en') | ||
194 | ->will($this->returnValue(array('Foo' => array('Bar' => array('one', 'two'))))); | ||
195 | |||
196 | $result = array('one', 'two'); | ||
197 | |||
198 | $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); | ||
199 | } | ||
200 | |||
201 | /** | ||
202 | * @dataProvider readMergedEntryProvider | ||
203 | */ | ||
204 | public function testReadMergedEntryWithTraversables($childData, $parentData, $result) | ||
205 | { | ||
206 | $parentData = is_array($parentData) ? new \ArrayObject($parentData) : $parentData; | ||
207 | $childData = is_array($childData) ? new \ArrayObject($childData) : $childData; | ||
208 | |||
209 | $this->readerImpl->expects($this->at(0)) | ||
210 | ->method('read') | ||
211 | ->with(self::RES_DIR, 'en_GB') | ||
212 | ->will($this->returnValue(array('Foo' => array('Bar' => $childData)))); | ||
213 | |||
214 | if (null === $childData || $childData instanceof \ArrayObject) { | ||
215 | $this->readerImpl->expects($this->at(1)) | ||
216 | ->method('read') | ||
217 | ->with(self::RES_DIR, 'en') | ||
218 | ->will($this->returnValue(array('Foo' => array('Bar' => $parentData)))); | ||
219 | } | ||
220 | |||
221 | $this->assertSame($result, $this->reader->readEntry(self::RES_DIR, 'en_GB', array('Foo', 'Bar'), true)); | ||
222 | } | ||
223 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php new file mode 100644 index 00000000..ccdf904c --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/RegionBundleTest.php | |||
@@ -0,0 +1,63 @@ | |||
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\RegionBundle; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class RegionBundleTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | const RES_DIR = '/base/region'; | ||
22 | |||
23 | /** | ||
24 | * @var RegionBundle | ||
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 RegionBundle(self::RES_DIR, $this->reader); | ||
37 | } | ||
38 | |||
39 | public function testGetCountryName() | ||
40 | { | ||
41 | $this->reader->expects($this->once()) | ||
42 | ->method('readEntry') | ||
43 | ->with(self::RES_DIR, 'en', array('Countries', 'AT')) | ||
44 | ->will($this->returnValue('Austria')); | ||
45 | |||
46 | $this->assertSame('Austria', $this->bundle->getCountryName('AT', 'en')); | ||
47 | } | ||
48 | |||
49 | public function testGetCountryNames() | ||
50 | { | ||
51 | $sortedCountries = array( | ||
52 | 'AT' => 'Austria', | ||
53 | 'DE' => 'Germany', | ||
54 | ); | ||
55 | |||
56 | $this->reader->expects($this->once()) | ||
57 | ->method('readEntry') | ||
58 | ->with(self::RES_DIR, 'en', array('Countries')) | ||
59 | ->will($this->returnValue($sortedCountries)); | ||
60 | |||
61 | $this->assertSame($sortedCountries, $this->bundle->getCountryNames('en')); | ||
62 | } | ||
63 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php new file mode 100644 index 00000000..d6f7d8a0 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Util/RingBufferTest.php | |||
@@ -0,0 +1,101 @@ | |||
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\Util; | ||
13 | |||
14 | use Symfony\Component\Intl\ResourceBundle\Util\RingBuffer; | ||
15 | |||
16 | /** | ||
17 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
18 | */ | ||
19 | class RingBufferTest extends \PHPUnit_Framework_TestCase | ||
20 | { | ||
21 | /** | ||
22 | * @var RingBuffer | ||
23 | */ | ||
24 | private $buffer; | ||
25 | |||
26 | protected function setUp() | ||
27 | { | ||
28 | $this->buffer = new RingBuffer(2); | ||
29 | } | ||
30 | |||
31 | public function testWriteWithinBuffer() | ||
32 | { | ||
33 | $this->buffer[0] = 'foo'; | ||
34 | $this->buffer['bar'] = 'baz'; | ||
35 | |||
36 | $this->assertTrue(isset($this->buffer[0])); | ||
37 | $this->assertTrue(isset($this->buffer['bar'])); | ||
38 | $this->assertSame('foo', $this->buffer[0]); | ||
39 | $this->assertSame('baz', $this->buffer['bar']); | ||
40 | } | ||
41 | |||
42 | public function testWritePastBuffer() | ||
43 | { | ||
44 | $this->buffer[0] = 'foo'; | ||
45 | $this->buffer['bar'] = 'baz'; | ||
46 | $this->buffer[2] = 'bam'; | ||
47 | |||
48 | $this->assertTrue(isset($this->buffer['bar'])); | ||
49 | $this->assertTrue(isset($this->buffer[2])); | ||
50 | $this->assertSame('baz', $this->buffer['bar']); | ||
51 | $this->assertSame('bam', $this->buffer[2]); | ||
52 | } | ||
53 | |||
54 | /** | ||
55 | * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException | ||
56 | */ | ||
57 | public function testReadNonExistingFails() | ||
58 | { | ||
59 | $this->buffer['foo']; | ||
60 | } | ||
61 | |||
62 | public function testQueryNonExisting() | ||
63 | { | ||
64 | $this->assertFalse(isset($this->buffer['foo'])); | ||
65 | } | ||
66 | |||
67 | public function testUnsetNonExistingSucceeds() | ||
68 | { | ||
69 | unset($this->buffer['foo']); | ||
70 | |||
71 | $this->assertFalse(isset($this->buffer['foo'])); | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * @expectedException \Symfony\Component\Intl\Exception\OutOfBoundsException | ||
76 | */ | ||
77 | public function testReadOverwrittenFails() | ||
78 | { | ||
79 | $this->buffer[0] = 'foo'; | ||
80 | $this->buffer['bar'] = 'baz'; | ||
81 | $this->buffer[2] = 'bam'; | ||
82 | |||
83 | $this->buffer[0]; | ||
84 | } | ||
85 | |||
86 | public function testQueryOverwritten() | ||
87 | { | ||
88 | $this->assertFalse(isset($this->buffer[0])); | ||
89 | } | ||
90 | |||
91 | public function testUnsetOverwrittenSucceeds() | ||
92 | { | ||
93 | $this->buffer[0] = 'foo'; | ||
94 | $this->buffer['bar'] = 'baz'; | ||
95 | $this->buffer[2] = 'bam'; | ||
96 | |||
97 | unset($this->buffer[0]); | ||
98 | |||
99 | $this->assertFalse(isset($this->buffer[0])); | ||
100 | } | ||
101 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php new file mode 100644 index 00000000..1ded57a7 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.php | |||
@@ -0,0 +1,23 @@ | |||
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 | return array( | ||
13 | 'Entry1' => array( | ||
14 | 'Array' => array( | ||
15 | 0 => 'foo', | ||
16 | 1 => 'bar', | ||
17 | ), | ||
18 | 'Integer' => 5, | ||
19 | 'Boolean' => false, | ||
20 | 'Float' => 1.23, | ||
21 | ), | ||
22 | 'Entry2' => 'String', | ||
23 | ); | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res new file mode 100644 index 00000000..7c1f71eb --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.res | |||
Binary files differ | |||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt new file mode 100644 index 00000000..0ee0d7f2 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/Fixtures/en.txt | |||
@@ -0,0 +1,23 @@ | |||
1 | en{ | ||
2 | Entry1{ | ||
3 | Array{ | ||
4 | "foo", | ||
5 | "bar", | ||
6 | { | ||
7 | Key{"value"} | ||
8 | }, | ||
9 | } | ||
10 | Integer:int{5} | ||
11 | IntVector:intvector{ | ||
12 | 0, | ||
13 | 1, | ||
14 | 2, | ||
15 | 3, | ||
16 | } | ||
17 | FalseBoolean{"false"} | ||
18 | TrueBoolean{"true"} | ||
19 | Null{""} | ||
20 | Float{"1.23"} | ||
21 | } | ||
22 | Entry2{"String"} | ||
23 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php new file mode 100644 index 00000000..03302834 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/PhpBundleWriterTest.php | |||
@@ -0,0 +1,62 @@ | |||
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\Writer; | ||
13 | |||
14 | use Symfony\Component\Filesystem\Filesystem; | ||
15 | use Symfony\Component\Intl\ResourceBundle\Writer\PhpBundleWriter; | ||
16 | |||
17 | /** | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | */ | ||
20 | class PhpBundleWriterTest extends \PHPUnit_Framework_TestCase | ||
21 | { | ||
22 | /** | ||
23 | * @var PhpBundleWriter | ||
24 | */ | ||
25 | private $writer; | ||
26 | |||
27 | private $directory; | ||
28 | |||
29 | /** | ||
30 | * @var Filesystem | ||
31 | */ | ||
32 | private $filesystem; | ||
33 | |||
34 | protected function setUp() | ||
35 | { | ||
36 | $this->writer = new PhpBundleWriter(); | ||
37 | $this->directory = sys_get_temp_dir() . '/PhpBundleWriterTest/' . rand(1000, 9999); | ||
38 | $this->filesystem = new Filesystem(); | ||
39 | |||
40 | $this->filesystem->mkdir($this->directory); | ||
41 | } | ||
42 | |||
43 | protected function tearDown() | ||
44 | { | ||
45 | $this->filesystem->remove($this->directory); | ||
46 | } | ||
47 | |||
48 | public function testWrite() | ||
49 | { | ||
50 | $this->writer->write($this->directory, 'en', array( | ||
51 | 'Entry1' => array( | ||
52 | 'Array' => array('foo', 'bar'), | ||
53 | 'Integer' => 5, | ||
54 | 'Boolean' => false, | ||
55 | 'Float' => 1.23, | ||
56 | ), | ||
57 | 'Entry2' => 'String', | ||
58 | )); | ||
59 | |||
60 | $this->assertFileEquals(__DIR__ . '/Fixtures/en.php', $this->directory . '/en.php'); | ||
61 | } | ||
62 | } | ||
diff --git a/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php new file mode 100644 index 00000000..cbe0c8d8 --- /dev/null +++ b/vendor/symfony/intl/Symfony/Component/Intl/Tests/ResourceBundle/Writer/TextBundleWriterTest.php | |||
@@ -0,0 +1,67 @@ | |||
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\Writer; | ||
13 | |||
14 | use Symfony\Component\Filesystem\Filesystem; | ||
15 | use Symfony\Component\Intl\ResourceBundle\Writer\TextBundleWriter; | ||
16 | |||
17 | /** | ||
18 | * @author Bernhard Schussek <bschussek@gmail.com> | ||
19 | * | ||
20 | * @see http://source.icu-project.org/repos/icu/icuhtml/trunk/design/bnf_rb.txt | ||
21 | */ | ||
22 | class TextBundleWriterTest extends \PHPUnit_Framework_TestCase | ||
23 | { | ||
24 | /** | ||
25 | * @var TextBundleWriter | ||
26 | */ | ||
27 | private $writer; | ||
28 | |||
29 | private $directory; | ||
30 | |||
31 | /** | ||
32 | * @var Filesystem | ||
33 | */ | ||
34 | private $filesystem; | ||
35 | |||
36 | protected function setUp() | ||
37 | { | ||
38 | $this->writer = new TextBundleWriter(); | ||
39 | $this->directory = sys_get_temp_dir() . '/TextBundleWriterTest/' . rand(1000, 9999); | ||
40 | $this->filesystem = new Filesystem(); | ||
41 | |||
42 | $this->filesystem->mkdir($this->directory); | ||
43 | } | ||
44 | |||
45 | protected function tearDown() | ||
46 | { | ||
47 | $this->filesystem->remove($this->directory); | ||
48 | } | ||
49 | |||
50 | public function testWrite() | ||
51 | { | ||
52 | $this->writer->write($this->directory, 'en', array( | ||
53 | 'Entry1' => array( | ||
54 | 'Array' => array('foo', 'bar', array('Key' => 'value')), | ||
55 | 'Integer' => 5, | ||
56 | 'IntVector' => array(0, 1, 2, 3), | ||
57 | 'FalseBoolean' => false, | ||
58 | 'TrueBoolean' => true, | ||
59 | 'Null' => null, | ||
60 | 'Float' => 1.23, | ||
61 | ), | ||
62 | 'Entry2' => 'String', | ||
63 | )); | ||
64 | |||
65 | $this->assertFileEquals(__DIR__ . '/Fixtures/en.txt', $this->directory . '/en.txt'); | ||
66 | } | ||
67 | } | ||