function YamlFileLoaderTest::testExceptions

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php \Drupal\Tests\Core\DependencyInjection\YamlFileLoaderTest::testExceptions()
  2. 11.x core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php \Drupal\Tests\Core\DependencyInjection\YamlFileLoaderTest::testExceptions()

@dataProvider providerTestExceptions

File

core/tests/Drupal/Tests/Core/DependencyInjection/YamlFileLoaderTest.php, line 83

Class

YamlFileLoaderTest
@coversDefaultClass \Drupal\Core\DependencyInjection\YamlFileLoader[[api-linebreak]] @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection

Code

public function testExceptions($yml, $message) : void {
  vfsStream::setup('drupal', NULL, [
    'modules' => [
      'example' => [
        'example.yml' => $yml,
      ],
    ],
  ]);
  $builder = new ContainerBuilder();
  $yaml_file_loader = new YamlFileLoader($builder);
  $this->expectException(\InvalidArgumentException::class);
  $this->expectExceptionMessage($message);
  $yaml_file_loader->load('vfs://drupal/modules/example/example.yml');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.