Author: Saša Stamenković (umpirsky@gmail.com)
Inheritance: extends Symfony\Component\Translation\Loader\FileLoader
示例#1
0
 public function testLoadDoesNothingIfEmpty()
 {
     $loader = new CsvFileLoader();
     $resource = __DIR__ . '/../fixtures/empty.csv';
     $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());
 }
示例#2
0
 /**
  * @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
  */
 public function testLoadNonLocalResource()
 {
     $loader = new CsvFileLoader();
     $resource = 'http://example.com/resources.csv';
     $loader->load($resource, 'en', 'domain1');
 }
示例#3
0
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testLoadThrowsAnExceptionIfFileNotLocal()
 {
     $loader = new CsvFileLoader();
     $resource = 'http://example.com/resources.csv';
     $loader->load($resource, 'en', 'domain1');
 }
 /**
  * @expectedException \InvalidArgumentException
  */
 public function testLoadThrowsAnExceptionIfFileNotExists()
 {
     $loader = new CsvFileLoader();
     $resource = __DIR__ . '/../fixtures/not-exists.csv';
     $loader->load($resource, 'en', 'domain1');
 }