You are here

class PhpFileLoaderTest in Zircon Profile 8.0

Same name in this branch
  1. 8.0 vendor/symfony/routing/Tests/Loader/PhpFileLoaderTest.php \Symfony\Component\Routing\Tests\Loader\PhpFileLoaderTest
  2. 8.0 vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php \Symfony\Component\Translation\Tests\Loader\PhpFileLoaderTest
  3. 8.0 vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\PhpFileLoaderTest
Same name and namespace in other branches
  1. 8 vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php \Symfony\Component\Translation\Tests\Loader\PhpFileLoaderTest

Hierarchy

  • class \Symfony\Component\Translation\Tests\Loader\PhpFileLoaderTest extends \Symfony\Component\Translation\Tests\Loader\PHPUnit_Framework_TestCase

Expanded class hierarchy of PhpFileLoaderTest

File

vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php, line 17

Namespace

Symfony\Component\Translation\Tests\Loader
View 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