You are here

public function YamlFileLoaderTest::testExceptions in Drupal 10

@dataProvider providerTestExceptions

File

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

Class

YamlFileLoaderTest
@coversDefaultClass \Drupal\Core\DependencyInjection\YamlFileLoader @group DependencyInjection

Namespace

Drupal\Tests\Core\DependencyInjection

Code

public function testExceptions($yml, $message) {
  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');
}