function LazyContextRepositoryTest::testGetRuntimeMultipleContextProviders

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

@covers ::getRuntimeContexts

File

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

Class

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

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function testGetRuntimeMultipleContextProviders() {
    $contexts0 = $this->setupContextAndProvider('test_provider', [
        'test_context0',
        'test_context1',
    ], [
        'test_context0',
    ]);
    $contexts1 = $this->setupContextAndProvider('test_provider2', [
        'test1_context0',
        'test1_context1',
    ], [
        'test1_context0',
    ]);
    $lazy_context_repository = new LazyContextRepository($this->container, [
        'test_provider',
    ]);
    $run_time_contexts = $lazy_context_repository->getRuntimeContexts([
        '@test_provider:test_context0',
        '@test_provider2:test1_context0',
    ]);
    $this->assertEquals([
        '@test_provider:test_context0' => $contexts0[0],
        '@test_provider2:test1_context0' => $contexts1[1],
    ], $run_time_contexts);
}

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