* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Intl\Tests\Data\Bundle\Reader; use PHPUnit\Framework\TestCase; use Symfony\Component\Intl\Data\Bundle\Reader\JsonBundleReader; /** * @author Bernhard Schussek */ class JsonBundleReaderTest extends TestCase { /** * @var JsonBundleReader */ private $reader; protected function setUp() { $this->reader = new JsonBundleReader(); } public function testReadReturnsArray() { $data = $this->reader->read(__DIR__.'/Fixtures/json', 'en'); $this->assertInternalType('array', $data); $this->assertSame('Bar', $data['Foo']); $this->assertArrayNotHasKey('ExistsNot', $data); } /** * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException */ public function testReadFailsIfNonExistingLocale() { $this->reader->read(__DIR__.'/Fixtures/json', 'foo'); } /** * @expectedException \Symfony\Component\Intl\Exception\RuntimeException */ public function testReadFailsIfNonExistingDirectory() { $this->reader->read(__DIR__.'/foo', 'en'); } /** * @expectedException \Symfony\Component\Intl\Exception\RuntimeException */ public function testReadFailsIfNotAFile() { $this->reader->read(__DIR__.'/Fixtures/NotAFile', 'en'); } /** * @expectedException \Symfony\Component\Intl\Exception\RuntimeException */ public function testReadFailsIfInvalidJson() { $this->reader->read(__DIR__.'/Fixtures/json', 'en_Invalid'); } /** * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException */ public function testReaderDoesNotBreakOutOfGivenPath() { $this->reader->read(__DIR__.'/Fixtures/json', '../invalid_directory/en'); } } __halt_compiler();----SIGNATURE:----VILTncuNPhDDoEpMGXNgtjJje8bSxXuI0T56Fur+6g6zGHhVSOHUT0k5zpNabCHJsS4HUPfWQo/qMDHpmA8XugjJVRoHYQPUYTbriuxXZ1JInr52mV8WXmN+pYU9rNrtfWodWwH82enAxD+MgipMUqa4EN47K2U4HDy6vnR5aPguh3X+uLEh8AqOAwcV1Ola84qaa3TVWFBrVVv+/i48EFw7VkypMN1X4dQ5AsaC+b6cd6t9+yD6JzsUO1bQP8cvt/abtvWAwjlwTF/TQNSwGDpNpULIifB1puxcqmRo1OaNOu96za7y9PCtNtM2VXH/fqXgPe7nBuJz3JxmK1as5DxTrhrmlveWHgwphJqPYOEmoxRIgisUzfyyM8zhOgsWGrfPxotA8xMX21I+OZqWmhpp0HCOnqTpjILNwaeWaMsHEIPWGHgxGphc3g+Cd4K7uM1+6D+4V4jRW2wQcbKyIpsrXOS/4QbIrV5QQ+76qwMX2PTQexCcKt/3ewRV1KfsrvQGdbsI4UwV+6YPrGO23SpgetJmPtI6pGqdc3vYQ30AuyO8Ohrf1+Z2tMAbDl0gvKYkSVBPGpT+VLrWyM6WiQUhPcEn096LYNW+l+f5FO/mNoYqT0ATsaRWLBc5seiCMMntNLj10RLcwVjop11rAIovDoZbzoH3+ow0Ip20L/A=----ATTACHMENT:----ODUwMzY4OTgzNTcyNjI4OCAxODg5MjYzMTQ2NTAwODgxIDg2MjA0NTE0ODQzNDMzMjA=