1 | 1 |
deleted file mode 100644 |
... | ... |
@@ -1,64 +0,0 @@ |
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\Translation\Tests\Loader; |
|
13 |
- |
|
14 |
-use Symfony\Component\Config\Resource\FileResource; |
|
15 |
-use Symfony\Component\Translation\Loader\IcuDatFileLoader; |
|
16 |
- |
|
17 |
-/** |
|
18 |
- * @requires extension intl |
|
19 |
- */ |
|
20 |
-class IcuDatFileLoaderTest extends LocalizedTestCase |
|
21 |
-{ |
|
22 |
- /** |
|
23 |
- * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException |
|
24 |
- */ |
|
25 |
- public function testLoadInvalidResource() |
|
26 |
- { |
|
27 |
- $loader = new IcuDatFileLoader(); |
|
28 |
- $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2'); |
|
29 |
- } |
|
30 |
- |
|
31 |
- public function testDatEnglishLoad() |
|
32 |
- { |
|
33 |
- // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form |
|
34 |
- // you must specify an temporary build directory which is not the same as current directory and |
|
35 |
- // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt |
|
36 |
- $loader = new IcuDatFileLoader(); |
|
37 |
- $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; |
|
38 |
- $catalogue = $loader->load($resource, 'en', 'domain1'); |
|
39 |
- |
|
40 |
- $this->assertEquals(['symfony' => 'Symfony 2 is great'], $catalogue->all('domain1')); |
|
41 |
- $this->assertEquals('en', $catalogue->getLocale()); |
|
42 |
- $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); |
|
43 |
- } |
|
44 |
- |
|
45 |
- public function testDatFrenchLoad() |
|
46 |
- { |
|
47 |
- $loader = new IcuDatFileLoader(); |
|
48 |
- $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; |
|
49 |
- $catalogue = $loader->load($resource, 'fr', 'domain1'); |
|
50 |
- |
|
51 |
- $this->assertEquals(['symfony' => 'Symfony 2 est génial'], $catalogue->all('domain1')); |
|
52 |
- $this->assertEquals('fr', $catalogue->getLocale()); |
|
53 |
- $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); |
|
54 |
- } |
|
55 |
- |
|
56 |
- /** |
|
57 |
- * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException |
|
58 |
- */ |
|
59 |
- public function testLoadNonExistingResource() |
|
60 |
- { |
|
61 |
- $loader = new IcuDatFileLoader(); |
|
62 |
- $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); |
|
63 |
- } |
|
64 |
-} |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -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\Translation\Tests\Loader; |
|
13 |
+ |
|
14 |
+use Symfony\Component\Config\Resource\FileResource; |
|
15 |
+use Symfony\Component\Translation\Loader\IcuDatFileLoader; |
|
16 |
+ |
|
17 |
+/** |
|
18 |
+ * @requires extension intl |
|
19 |
+ */ |
|
20 |
+class IcuDatFileLoaderTest extends LocalizedTestCase |
|
21 |
+{ |
|
22 |
+ /** |
|
23 |
+ * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException |
|
24 |
+ */ |
|
25 |
+ public function testLoadInvalidResource() |
|
26 |
+ { |
|
27 |
+ $loader = new IcuDatFileLoader(); |
|
28 |
+ $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2'); |
|
29 |
+ } |
|
30 |
+ |
|
31 |
+ public function testDatEnglishLoad() |
|
32 |
+ { |
|
33 |
+ // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form |
|
34 |
+ // you must specify an temporary build directory which is not the same as current directory and |
|
35 |
+ // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt |
|
36 |
+ $loader = new IcuDatFileLoader(); |
|
37 |
+ $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; |
|
38 |
+ $catalogue = $loader->load($resource, 'en', 'domain1'); |
|
39 |
+ |
|
40 |
+ $this->assertEquals(['symfony' => 'Symfony 2 is great'], $catalogue->all('domain1')); |
|
41 |
+ $this->assertEquals('en', $catalogue->getLocale()); |
|
42 |
+ $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); |
|
43 |
+ } |
|
44 |
+ |
|
45 |
+ public function testDatFrenchLoad() |
|
46 |
+ { |
|
47 |
+ $loader = new IcuDatFileLoader(); |
|
48 |
+ $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; |
|
49 |
+ $catalogue = $loader->load($resource, 'fr', 'domain1'); |
|
50 |
+ |
|
51 |
+ $this->assertEquals(['symfony' => 'Symfony 2 est génial'], $catalogue->all('domain1')); |
|
52 |
+ $this->assertEquals('fr', $catalogue->getLocale()); |
|
53 |
+ $this->assertEquals([new FileResource($resource.'.dat')], $catalogue->getResources()); |
|
54 |
+ } |
|
55 |
+ |
|
56 |
+ /** |
|
57 |
+ * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException |
|
58 |
+ */ |
|
59 |
+ public function testLoadNonExistingResource() |
|
60 |
+ { |
|
61 |
+ $loader = new IcuDatFileLoader(); |
|
62 |
+ $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); |
|
63 |
+ } |
|
64 |
+} |