function YamlFileLoaderTest::testExceptions

Same name in other branches
  1. 10 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 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');
}

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