* * 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\YamlFileLoader; use Symfony\Component\Config\Resource\FileResource; class YamlFileLoaderTest extends TestCase { public function testLoad() { $loader = new YamlFileLoader(); $resource = __DIR__.'/../fixtures/resources.yml'; $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 YamlFileLoader(); $resource = __DIR__.'/../fixtures/empty.yml'; $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 YamlFileLoader(); $resource = __DIR__.'/../fixtures/non-existing.yml'; $loader->load($resource, 'en', 'domain1'); } /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException */ public function testLoadThrowsAnExceptionIfFileNotLocal() { $loader = new YamlFileLoader(); $resource = 'http://example.com/resources.yml'; $loader->load($resource, 'en', 'domain1'); } /** * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException */ public function testLoadThrowsAnExceptionIfNotAnArray() { $loader = new YamlFileLoader(); $resource = __DIR__.'/../fixtures/non-valid.yml'; $loader->load($resource, 'en', 'domain1'); } } __halt_compiler();----SIGNATURE:----UbruSFJby+7yzQuIevARurI6RCRtSQl3yUt5pCADdxJSmdD4FISwSBqwJddPqboELRLoWjCwM/35kow0b/s47aXN2esvtM369GnXCJWMgkWZzH2+2VU8oF0JkReMM4BN22A3qJeqLnVG/vtVk5wNCfdFUxRxRdHrlQlxdndrTZrfv3tJGn+aMvSEADBeOz7vcIHrOptrvZZ/kdCdytPtXye8Jd2609fkpGO3JvKXhjKcx1V8Asp6TYi0XWpOEIHfo98/7XxoqF07m3RpvmHYzB05dz+Lt3At29qLwpYjaKS8yD606pK2ab6M09UOYTDWzW1VnxAQen/5q0kAdNJiZBUMF+qWNF7RwIdaAsvriLIecFffdGO4IuytaX6DsU9e35KP/XAbADd0g9dd/YqoIPzgyj1vXUs/EysJ2zNx3mhYd++xii8XxJgtjZjFjUsLfx2iSIEKAFzfXBruyEEKVbzQNndA5R/zlA3mQMl+eHpw1pQmIftqdPh/hwl/V88Udk2X2dCnNm3wsMXzjS7tzZua1kYCWb93yjdVTb1J/9nnvsYLYjQRIUv2+KWxR0KWzLcnV1D445W/HNdQlPQa8rTPV3PLJYc2Vokuy87wn7PHQul76oV7+WeUSJ1Y+qn58Nx/ssHAXaUefl4GljdPFWA9AeGSnnxzkLd+G1q86xs=----ATTACHMENT:----NzQzNDM3NDUwNTc2OTI2NCAyODUwNDQzNjA5NTEwNTczIDgyNDYxMDk3NDgyNzcwNzI=