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. 10 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 <a href="/api/drupal/core%21lib%21Drupal%21Core%21DependencyInjection%21YamlFileLoader.php/class/YamlFileLoader/11.x" title="YamlFileLoader loads YAML files service definitions." class="local">\Drupal\Core\DependencyInjection\YamlFileLoader</a> @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.