* * 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\JsonFileLoader; use Symfony\Component\Config\Resource\FileResource; class JsonFileLoaderTest extends TestCase { public function testLoad() { $loader = new JsonFileLoader(); $resource = __DIR__.'/../fixtures/resources.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals(array('foo' => 'bar'), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } public function testLoadDoesNothingIfEmpty() { $loader = new JsonFileLoader(); $resource = __DIR__.'/../fixtures/empty.json'; $catalogue = $loader->load($resource, 'en', 'domain1'); $this->assertEquals(array(), $catalogue->all('domain1')); $this->assertEquals('en', $catalogue->getLocale()); $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); } /** * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException */ public function testLoadNonExistingResource() { $loader = new JsonFileLoader(); $resource = __DIR__.'/../fixtures/non-existing.json'; $loader->load($resource, 'en', 'domain1'); } /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException * @expectedExceptionMessage Error parsing JSON - Syntax error, malformed JSON */ public function testParseException() { $loader = new JsonFileLoader(); $resource = __DIR__.'/../fixtures/malformed.json'; $loader->load($resource, 'en', 'domain1'); } } __halt_compiler();----SIGNATURE:----jrHpaiFGC8bJ5GcKknDwiDCU1g8ijnv3MWPqdu9MtjHUshSQ/T352kcsXdJzph5iRphoxOg+ha58hEmfX3xiEHhHCsu2QY5bNBtKKQZ808SAxAzJ/BjRk7v/mVfCR8NE/+lZCQTmFhaWG702/9Hz5p4Nty1SN/WDhCD/9FQ+bz8+CXSF99weVWee+og2Rz524OtwtNzD3VvD6EHuohBo9kZiaa/naaDBYJSbgC463ByjSYFg1nqRdYfw57QAMNWDl6s9Un1uXa9bQrbj3ItP89lbrriQo9TductAvEgEpj/EY7ThDmXmkFuw5ask8L5PLxFhX53GEaSW5pb18MzYYNGvjYniOepMPxErXAgBFar2Bu/XoK1TJ4g9WB3rSoXh7cg7iFZvzyzBaU7kE7hX4n3KtHdEaH8B5YQmHtslgg7r+8yN1kIpgie70W0axpCooLyO6oM6mYNR1K4rlUtbDKtK1cZ6Na/DqlDFTdNvHIUEYcrGR39idhnQq1mLAnp4MIU0X5PE/z2lHd1tV6/Yk4BftiUKwiFTGC76kpOhw+LEA7JaJDi7V1tXknFjGNuZ1d+JgXU8O5oByMnmk3Xz9mmquf4BFJFlh6MRCBKQToIX7ctfd3Fa8bTwY2eyky+y0CsBNbbd09I+q1KByQOSKN8ZM7cb/+HAhcb2Il33BNo=----ATTACHMENT:----NzQ3Mjc4MjgxNDI0NzEyNyA4MjI4OTk3NDYwNzUwODY1IDc1ODg5NjE2NDIzNDc2MzQ=