You are here

public function LazyContextRepositoryTest::testInvalidContextId in Drupal 8

Same name and namespace in other branches
  1. 9 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',
  ]);
}