SymfonyComponentTranslationTestsLoaderQtFileLoaderTest

The Simple Calendar Symfony Component Translation Tests Loader QtFileLoaderTest class.

Defined (1)

The class is defined in the following location(s).

/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php  
  1. class QtFileLoaderTest extends \PHPUnit_Framework_TestCase 
  2. public function testLoad() 
  3. $loader = new QtFileLoader(); 
  4. $resource = __DIR__.'/../fixtures/resources.ts'; 
  5. $catalogue = $loader->load($resource, 'en', 'resources'); 
  6.  
  7. $this->assertEquals(array('foo' => 'bar'), $catalogue->all('resources')); 
  8. $this->assertEquals('en', $catalogue->getLocale()); 
  9. $this->assertEquals(array(new FileResource($resource)), $catalogue->getResources()); 
  10.  
  11. /** 
  12. * @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException 
  13. */ 
  14. public function testLoadNonExistingResource() 
  15. $loader = new QtFileLoader(); 
  16. $resource = __DIR__.'/../fixtures/non-existing.ts'; 
  17. $loader->load($resource, 'en', 'domain1'); 
  18.  
  19. /** 
  20. * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException 
  21. */ 
  22. public function testLoadNonLocalResource() 
  23. $loader = new QtFileLoader(); 
  24. $resource = 'http://domain1.com/resources.ts'; 
  25. $loader->load($resource, 'en', 'domain1'); 
  26.  
  27. /** 
  28. * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException 
  29. */ 
  30. public function testLoadInvalidResource() 
  31. $loader = new QtFileLoader(); 
  32. $resource = __DIR__.'/../fixtures/invalid-xml-resources.xlf'; 
  33. $loader->load($resource, 'en', 'domain1'); 
  34.  
  35. public function testLoadEmptyResource() 
  36. $loader = new QtFileLoader(); 
  37. $resource = __DIR__.'/../fixtures/empty.xlf'; 
  38. $this->setExpectedException('Symfony\Component\Translation\Exception\InvalidResourceException', sprintf('Unable to load "%s".', $resource)); 
  39. $loader->load($resource, 'en', 'domain1');