You are here

public function YamlFileLoaderTest::testNonArrayTagsThrowsException in Zircon Profile 8.0

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

File

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

Class

YamlFileLoaderTest

Namespace

Symfony\Component\DependencyInjection\Tests\Loader

Code

public function testNonArrayTagsThrowsException() {
  $loader = new YamlFileLoader(new ContainerBuilder(), new FileLocator(self::$fixturesPath . '/yaml'));
  try {
    $loader
      ->load('badtag1.yml');
    $this
      ->fail('->load() should throw an exception when the tags key of a service is not an array');
  } catch (\Exception $e) {
    $this
      ->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException', $e, '->load() throws an InvalidArgumentException if the tags key is not an array');
    $this
      ->assertStringStartsWith('Parameter "tags" must be an array for service', $e
      ->getMessage(), '->load() throws an InvalidArgumentException if the tags key is not an array');
  }
}