function LazyContextRepositoryTest::testInvalidContextId

Tests invalid context id.

@legacy-covers ::getRuntimeContexts

File

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

Class

LazyContextRepositoryTest
Tests Drupal\Core\Plugin\Context\LazyContextRepository.

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function testInvalidContextId() : void {
  $lazy_context_repository = new LazyContextRepository($this->container, [
    'test_provider',
  ]);
  $this->expectException(\AssertionError::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.