* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Translation\Tests\Loader; use Symfony\Component\Translation\Loader\IcuDatFileLoader; use Symfony\Component\Config\Resource\FileResource; /** * @requires extension intl */ class IcuDatFileLoaderTest extends LocalizedTestCase { /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException */ public function testLoadInvalidResource() { $loader = new IcuDatFileLoader(); $loader->load(__DIR__.'/../fixtures/resourcebundle/corrupted/resources', 'es', 'domain2'); } public function testDatEnglishLoad() { // bundled resource is build using pkgdata command which at least in ICU 4.2 comes in extremely! buggy form // you must specify an temporary build directory which is not the same as current directory and // MUST reside on the same partition. pkgdata -p resources -T /srv -d.packagelist.txt $loader = new IcuDatFileLoader(); $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals(array('symfony' => 'Symfony 2 is great'), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); } public function testDatFrenchLoad() { $loader = new IcuDatFileLoader(); $resource = __DIR__.'/../fixtures/resourcebundle/dat/resources'; $catalogue = $loader->load($resource, 'fr', 'domain1'); $this->assertEquals(array('symfony' => 'Symfony 2 est génial'), $catalogue->all('domain1')); $this->assertEquals('fr', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource.'.dat')), $catalogue->getResources()); } /** * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException */ public function testLoadNonExistingResource() { $loader = new IcuDatFileLoader(); $loader->load(__DIR__.'/../fixtures/non-existing.txt', 'en', 'domain1'); } } __halt_compiler();----SIGNATURE:----fI5w/i3oE4ItZQJwvjNn1GQj97isRDJPrb/5sdayKebztoGw6c+Ll5uaHGWm1l0RbFDn2LsWCnpODmav3N5Pz1qupScQ6JXVAhYvei7v5p+sJaHs1gWzPTLszN0yiCxJoh062Q6o7vsYDPx5QLSEmIteYqf5foxj46XtWNQH61qmlx8F5f8DYOPKGXJB/clmHo3UpFuF/CbRG4TPswZBsg8V9cAVNhbQcvKUr4zPyAOl2/aeRI6GNU8PhNTasDA66jiIFkysKg7E60JQnX8rQsiu+atY1MoxGmjAKEK+4yh8CWFaC+hMS4pnaf9toTxLoGtr7pX/SWjP/RjkqRpj05ecIgb4bGgQ51s6za/PbY5IeBSfTEntKPYJge3Ue+/07eEwAzAvqPkwq3eEwQnBKfQpEKCyZLdWpwp1J+0seZgemvFNhkr8dby9SygPVR9W4EqdWjXcs2xLDufeAv1NSUcjp+VuJL43aei/ZX1CYVxfLXETE7pLTfs6VoApL05urUt7QvbkEDVxNCpSwPmi01wkM8jDIb3f7oSWDwLvi3pjfO+X7ig8xCypadBN/qjH06BBBWu0jnwgan8hYI135lIDkrWsEfEEByv23ec4YzJfQ311qx6326Yn5tlGBASObhwz71kerrdvQ/rA4GU1mUyKfxhTuVSSo1VFan9pJIE=----ATTACHMENT:----OTk5NTY3NDI5MzMzNzI0NyA4MjkwMTk2OTA3MTg0NTU5IDQxMTEwNTgyNDU3NTg0ODM=