* * 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 PHPUnit\Framework\TestCase; use Symfony\Component\Translation\Loader\QtFileLoader; use Symfony\Component\Config\Resource\FileResource; class QtFileLoaderTest extends TestCase { public function testLoad() { $loader = new QtFileLoader(); $resource = __DIR__.'/../fixtures/resources.ts'; $catalogue = $loader->load($resource, 'en', 'resources'); $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } /** * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException */ public function testLoadNonExistingResource() { $loader = new QtFileLoader(); $resource = __DIR__.'/../fixtures/non-existing.ts'; $loader->load($resource, 'en', 'domain1'); } /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException */ public function testLoadNonLocalResource() { $loader = new QtFileLoader(); $resource = 'http://domain1.com/resources.ts'; $loader->load($resource, 'en', 'domain1'); } /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException */ public function testLoadInvalidResource() { $loader = new QtFileLoader(); $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf'; $loader->load($resource, 'en', 'domain1'); } public function testLoadEmptyResource() { $loader = new QtFileLoader(); $resource = __DIR__.'/../fixtures/empty.xlf'; if (method_exists($this, 'expectException')) { $this->expectException('Symfony\Component\Translation\Exception\InvalidResourceException'); $this->expectExceptionMessage(sprintf('Unable to load "%s".', $resource)); } else { $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource)); } $loader->load($resource, 'en', 'domain1'); } } __halt_compiler();----SIGNATURE:----qIp5y2gOAmUD/s3RmpeFCeQKThzoqzglTR9beI1J0wkwADkw6KoTOdydRCze/UhCNyYh15lqj+b1lkKVHUPMdTDOvC1Pb97nnGx5whIcuOZUZc3hY/ROXseE9YM+khk5A7AxJSt4LwYv4BOAWQ6+4t3sj4vLHh1TH65Q1JrHJjo7/z7BeIcNEHRHU6FSIxi3WmfAfNOshYN9i1tGq34YhZaOsV2UDUXElOkn35NScuYqciIMvA+ikEyhkz9nWfHl9mHFGJxMDX6ip8n4kdarMSbLTiD1C32JuakJDKQ1lXyQcZoun1KUdRX9txrdAMZYP2yNtrDL6JwBdeEcswWUrb2Miuof4RwXUtOhlE/HjwAomPk27wm/ensw15R+G+g015QscznS6V5n8ec/isUYc33NhT3ZFQPCTSkZPSEiIaLPTqT8ptv+ObvH8Atln3mwFEPJ2ELgnJDhaPWoZ3AzuRoBbvtf321odPZmQXcoM4Pl0vWYdNfbl7P0qFD21/hAIp91BCKowggOz464x9PM+ireiAtqCKSXTLn/MdSfT+70hVHDD+j0r2v3T+d/2HbzPjt3jW/pqSrl/QJZXuyRR6qv2XFAZfhbm49aZENBGzAw0lz/L+GVifS3ugVAYn0uAHxKsZNE9FYR2xstkuSn9DlXoqQKfKu4MMdduE3cYcw=----ATTACHMENT:----NjcyNDM4MzU0OTc2MDQ2IDkzNTUzNDc2MDE1NTgyMDYgNzQyNjgyOTA1NzAxMDY5Mw==