Security update for Core, with self-updated composer
[yaffs-website] / vendor / symfony / translation / Tests / Loader / IcuResFileLoaderTest.php
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\IcuResFileLoader;
15 use Symfony\Component\Config\Resource\DirectoryResource;
16
17 /**
18  * @requires extension intl
19  */
20 class IcuResFileLoaderTest extends LocalizedTestCase
21 {
22     public function testLoad()
23     {
24         // resource is build using genrb command
25         $loader = new IcuResFileLoader();
26         $resource = __DIR__.'/../fixtures/resourcebundle/res';
27         $catalogue = $loader->load($resource, 'en', 'domain1');
28
29         $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
30         $this->assertEquals('en', $catalogue->getLocale());
31         $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources());
32     }
33
34     /**
35      * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
36      */
37     public function testLoadNonExistingResource()
38     {
39         $loader = new IcuResFileLoader();
40         $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
41     }
42
43     /**
44      * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
45      */
46     public function testLoadInvalidResource()
47     {
48         $loader = new IcuResFileLoader();
49         $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1');
50     }
51 }