4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Translation\Tests\Loader;
14 use Symfony\Component\Translation\Loader\IcuResFileLoader;
15 use Symfony\Component\Config\Resource\DirectoryResource;
18 * @requires extension intl
20 class IcuResFileLoaderTest extends LocalizedTestCase
22 public function testLoad()
24 // resource is build using genrb command
25 $loader = new IcuResFileLoader();
26 $resource = __DIR__.'/../fixtures/resourcebundle/res';
27 $catalogue = $loader->load($resource, 'en', 'domain1');
29 $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1'));
30 $this->assertEquals('en', $catalogue->getLocale());
31 $this->assertEquals(array(new DirectoryResource($resource)), $catalogue->getResources());
35 * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
37 public function testLoadNonExistingResource()
39 $loader = new IcuResFileLoader();
40 $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1');
44 * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
46 public function testLoadInvalidResource()
48 $loader = new IcuResFileLoader();
49 $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted', 'en', 'domain1');