class PhpFileLoaderTest in Plug 7
Hierarchy
- class \Symfony\Component\Translation\Tests\Loader\PhpFileLoaderTest extends \Symfony\Component\Translation\Tests\Loader\PHPUnit_Framework_TestCase
Expanded class hierarchy of PhpFileLoaderTest
File
- lib/
Symfony/ translation/ Tests/ Loader/ PhpFileLoaderTest.php, line 17
Namespace
Symfony\Component\Translation\Tests\LoaderView source
class PhpFileLoaderTest extends \PHPUnit_Framework_TestCase {
public function testLoad() {
$loader = new PhpFileLoader();
$resource = __DIR__ . '/../fixtures/resources.php';
$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());
}
/**
* @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException
*/
public function testLoadNonExistingResource() {
$loader = new PhpFileLoader();
$resource = __DIR__ . '/../fixtures/non-existing.php';
$loader
->load($resource, 'en', 'domain1');
}
/**
* @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException
*/
public function testLoadThrowsAnExceptionIfFileNotLocal() {
$loader = new PhpFileLoader();
$resource = 'http://example.com/resources.php';
$loader
->load($resource, 'en', 'domain1');
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpFileLoaderTest:: |
public | function | ||
PhpFileLoaderTest:: |
public | function | @expectedException \Symfony\Component\Translation\Exception\NotFoundResourceException | |
PhpFileLoaderTest:: |
public | function | @expectedException \Symfony\Component\Translation\Exception\InvalidResourceException |