* * 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:----rD5I4vkSindxUNrCputgZvt2a4cTvsxYCJDfnmDki431LhHQa19I+qUgOjI7zyfeUq3RXq0iX94MCUuU/eano75+W5fvsqUF1yyOPAaadLFRSt/GogHataSysx2UYDQd3bVGDEtESZBBoAJbbzTyAwURErskeL3sEXhomkceubn9YzSs5kCzgwTs0k2iFrzxX2/GxShfBYIXTigeZqW19LaILMUlvah+HKRuIricvsFpIjuBJCvFFmeas6HueM0iuIQLlVY7lleF8m+sCsVjnPNJvSN56w3NN4AXN7LsQTwGe+BBdwfsMiGtBENihca1jEMD1yC1NWMZKspTjjWIycy17egzNQm9OoPPsV13h1PIamUey/JZRWYoAxCRXn9RiYn/8FINyRWDKZu0owkQb0VjzdtSUAM+1eAgA4dNLtKrDXI/DmMA6M31x5mWw9RgxzvQoZqR4ags2qshF4p1za6gw5tiy8lzgjRqpmbHCUfxKs1nOEM8RqyP3UDwc2os/Sj1Rlcw0BTuR6dBUV/F+om3nLC8hiIQ8XFH33bgQ/g2nQwmatqq8RAePQNS7PYBRjuDR89JDUa8ztAXSUwCEGEjScF4ET60k4P1Vb1ltnF87H7DLBVjWxYCUe0uvdC+FI/RtjbdUPSjgGyeGj6wYO8z6TR0daqiOg2sKF+1V58=----ATTACHMENT:----Mjk5NTQyNjk1NjMxMDgzNCAzOTkwMjMzODUwMjE4NzQyIDYzODU2ODk5NTcwODc5NQ==