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/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php | |
parent | 2b840e0cfb63a453bea67a98541f3df9c273c5f5 (diff) | |
download | wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.gz wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.tar.zst wallabag-4f5b44bd3bd490309eb2ba7b44df4769816ba729.zip |
twig implementation
Diffstat (limited to 'vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php')
-rw-r--r-- | vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php new file mode 100644 index 00000000..a3bd67ab --- /dev/null +++ b/vendor/symfony/translation/Symfony/Component/Translation/Tests/Loader/IcuDatFileLoaderTest.php | |||
@@ -0,0 +1,72 @@ | |||
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\Translation\Loader\IcuDatFileLoader; | ||
15 | use Symfony\Component\Config\Resource\FileResource; | ||
16 | |||
17 | class IcuDatFileLoaderTest extends LocalizedTestCase | ||
18 | { | ||
19 | protected function setUp() | ||
20 | { | ||
21 | if (!class_exists('Symfony\Component\Config\Loader\Loader')) { | ||
22 | $this->markTestSkipped('The "Config" component is not available'); | ||
23 | } | ||
24 | |||
25 | if (!extension_loaded('intl')) { | ||
26 | $this->markTestSkipped('This test requires intl extension to work.'); | ||
27 | } | ||
28 | } | ||
29 | |||
30 | /** | ||
31 | * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException | ||
32 | */ | ||
33 | public function testLoadInvalidResource() | ||
34 | { | ||
35 | $loader = new IcuDatFileLoader(); | ||
36 | $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2'); | ||
37 | } | ||
38 | |||
39 | public function testDatEnglishLoad() | ||
40 | { | ||
41 | // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form | ||
42 | // you must specify an temporary build directory which is not the same as current directory and | ||
43 | // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt | ||
44 | $loader = new IcuDatFileLoader(); | ||
45 | $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; | ||
46 | $catalogue = $loader->load($resource, 'en', 'domain1'); | ||
47 | |||
48 | $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1')); | ||
49 | $this->assertEquals('en', $catalogue->getLocale()); | ||
50 | $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); | ||
51 | } | ||
52 | |||
53 | public function testDatFrenchLoad() | ||
54 | { | ||
55 | $loader = new IcuDatFileLoader(); | ||
56 | $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; | ||
57 | $catalogue = $loader->load($resource, 'fr', 'domain1'); | ||
58 | |||
59 | $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1')); | ||
60 | $this->assertEquals('fr', $catalogue->getLocale()); | ||
61 | $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); | ||
62 | } | ||
63 | |||
64 | /** | ||
65 | * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException | ||
66 | */ | ||
67 | public function testLoadNonExistingResource() | ||
68 | { | ||
69 | $loader = new IcuDatFileLoader(); | ||
70 | $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); | ||
71 | } | ||
72 | } | ||