You are here

public function YamlFileLoaderTest::testTagWithoutNameThrowsException in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\YamlFileLoaderTest::testTagWithoutNameThrowsException()

File

vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php, line 248

Class

YamlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testTagWithoutNameThrowsException() {
  $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml'));
  try {
    $loader
      ->load('badtag2.yml');
    $this
      ->fail('->load() should throw an exception when a tag is missing the name key');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if a tag is missing the name key');
    $this
      ->assertStringStartsWith('A "tags" entry is missing a "name" key for service ', $e
      ->getMessage(), '->load() throws an InvalidArgumentException if a tag is missing the name key');
  }
}