You are here

public function XmlFileLoaderTest::testLoad in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testLoad()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php, line 36

Class

XmlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testLoad() {
  $loader = new XmlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/ini'));
  try {
    $loader
      ->load('foo.xml');
    $this
      ->fail('->load() throws an InvalidArgumentException if the loaded file does not exist');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the loaded file does not exist');
    $this
      ->assertStringStartsWith('The file "foo.xml" does not exist (in:', $e
      ->getMessage(), '->load() throws an InvalidArgumentException if the loaded file does not exist');
  }
}