function LazyContextRepositoryTest::testGetAvailableContexts

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

@covers ::getAvailableContexts

File

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

Class

LazyContextRepositoryTest
@coversDefaultClass \Drupal\Core\Plugin\Context\LazyContextRepository[[api-linebreak]] @group context

Namespace

Drupal\Tests\Core\Plugin\Context

Code

public function testGetAvailableContexts() : void {
  $contexts0 = $this->setupContextAndProvider('test_provider0', [
    'test0_context0',
    'test0_context1',
  ]);
  $contexts1 = $this->setupContextAndProvider('test_provider1', [
    'test1_context0',
    'test1_context1',
  ]);
  $lazy_context_repository = new LazyContextRepository($this->container, [
    'test_provider0',
    'test_provider1',
  ]);
  $contexts = $lazy_context_repository->getAvailableContexts();
  $this->assertEquals([
    '@test_provider0:test0_context0' => $contexts0[0],
    '@test_provider0:test0_context1' => $contexts0[1],
    '@test_provider1:test1_context0' => $contexts1[0],
    '@test_provider1:test1_context1' => $contexts1[1],
  ], $contexts);
}

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