function LazyContextRepositoryTest::testInvalidContextId

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php \Drupal\Tests\Core\Plugin\Context\LazyContextRepositoryTest::testInvalidContextId()
  2. 10 core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php \Drupal\Tests\Core\Plugin\Context\LazyContextRepositoryTest::testInvalidContextId()
  3. 11.x core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php \Drupal\Tests\Core\Plugin\Context\LazyContextRepositoryTest::testInvalidContextId()

@covers ::getRuntimeContexts

File

core/tests/Drupal/Tests/Core/Plugin/Context/LazyContextRepositoryTest.php, line 70

Class

LazyContextRepositoryTest
@coversDefaultClass \Drupal\Core\Plugin\Context\LazyContextRepository @group context

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function testInvalidContextId() {
    $lazy_context_repository = new LazyContextRepository($this->container, [
        'test_provider',
    ]);
    $this->expectException(\InvalidArgumentException::class);
    $this->expectExceptionMessage('You must provide the context IDs in the @{service_id}:{unqualified_context_id} format.');
    $lazy_context_repository->getRuntimeContexts([
        'test_context',
        '@test_provider:test_context1',
    ]);
}

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