function YamlFileLoaderTest::testExceptions

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

Tests exceptions.

Attributes

#[DataProvider('providerTestExceptions')]

File

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

Class

YamlFileLoaderTest
Tests Drupal\Core\DependencyInjection\YamlFileLoader.

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.