* * 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\IntlBundleReader; /** * @author Bernhard Schussek * @requires extension intl */ class IntlBundleReaderTest extends TestCase { /** * @var IntlBundleReader */ private $reader; protected function setUp() { $this->reader = new IntlBundleReader(); } public function testReadReturnsArrayAccess() { $data = $this->reader->read(__DIR__.'/Fixtures/res', 'ro'); $this->assertInstanceOf('\ArrayAccess', $data); $this->assertSame('Bar', $data['Foo']); $this->assertArrayNotHasKey('ExistsNot', $data); } public function testReadFollowsAlias() { // "alias" = "ro" $data = $this->reader->read(__DIR__.'/Fixtures/res', 'alias'); $this->assertInstanceOf('\ArrayAccess', $data); $this->assertSame('Bar', $data['Foo']); $this->assertArrayNotHasKey('ExistsNot', $data); } public function testReadDoesNotFollowFallback() { if (defined('HHVM_VERSION')) { $this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.'); } // "ro_MD" -> "ro" $data = $this->reader->read(__DIR__.'/Fixtures/res', 'ro_MD'); $this->assertInstanceOf('\ArrayAccess', $data); $this->assertSame('Bam', $data['Baz']); $this->assertArrayNotHasKey('Foo', $data); $this->assertNull($data['Foo']); $this->assertArrayNotHasKey('ExistsNot', $data); } public function testReadDoesNotFollowFallbackAlias() { if (defined('HHVM_VERSION')) { $this->markTestSkipped('ResourceBundle does not support disabling fallback properly on HHVM.'); } // "mo" = "ro_MD" -> "ro" $data = $this->reader->read(__DIR__.'/Fixtures/res', 'mo'); $this->assertInstanceOf('\ArrayAccess', $data); $this->assertSame('Bam', $data['Baz'], 'data from the aliased locale can be accessed'); $this->assertArrayNotHasKey('Foo', $data); $this->assertNull($data['Foo']); $this->assertArrayNotHasKey('ExistsNot', $data); } /** * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException */ public function testReadFailsIfNonExistingLocale() { $this->reader->read(__DIR__.'/Fixtures/res', 'foo'); } /** * @expectedException \Symfony\Component\Intl\Exception\ResourceBundleNotFoundException */ public function testReadFailsIfNonExistingFallbackLocale() { $this->reader->read(__DIR__.'/Fixtures/res', 'ro_AT'); } /** * @expectedException \Symfony\Component\Intl\Exception\RuntimeException */ public function testReadFailsIfNonExistingDirectory() { $this->reader->read(__DIR__.'/foo', 'ro'); } } __halt_compiler();----SIGNATURE:----jEw4FFQ5qIt5VWpX5Q5Cr71YnYtktqHR2bhPaaPm5AX+bUfpWdbq1VYRvHySFrZn8NRfk1ODzjQNJZydim2JP+H36wkuTl3hbXN5vpQL5R206S/m6tYywcBKQ1KxLTZrKyY+G28UEg92f4T0CeM5tNKLRbq6nFRINXvUyzGXOMHphsHEe6+DtxaZIO3v+tsKGSWXqAO01gReXs0lGC7s9FpuRlvyoc/HGBem6FSt72dAwqVxFNh1Y2Bp+qLBRYdEqa2PlYZFNdkOy6xX4r9oH8VTdc7S53eRc0rKEiJP5umZWny7DQLS+9jJGdmabehXCDfqMJ7wlWGKyjSkFg83U0IB51+TpB21SSPeCoEEB+MV5VP0WTyCf3PBO5tFAd7xe9wDD8x9+4Ayl615fh+M1DvTIlo4juf5w8e76PGlUKQseazMrtDorYwqhaRQXl9UH+Ll/6ymgoC0DTIvSvRq2wR8Hl9tLgn4+8GdGBKTxBdVIvh7XcYVoDvKf4Np11HbUaJuTFr9fPM7ZQiM3DD78MrNGKynMvb0ZobpcY/gxezVXcexuw/+H0GkrOsR93RMA3P6lOYuZKV6foxnt5OgViKWZWD3e5hwpcL7vzt7G7G8LHDGEKUugP6VlM3OWUa054W9eSHQYY3ocnzefij1cziaqjIFFxTVRLSu4jSN9pE=----ATTACHMENT:----NjM4MTY2MjMxMTQ3NjMzNCAyMjEzODI0NjQ2MDA5MDI3IDQyMDU5MjQ2ODA0MjI5Ng==