You are here

public function PlaceholderResolverTest::testGlobalContextVariable in Typed Data API enhancements 8

@covers ::replacePlaceHolders

File

tests/src/Kernel/PlaceholderResolverTest.php, line 409

Class

PlaceholderResolverTest
Tests the placeholder resolver.

Namespace

Drupal\Tests\typed_data\Kernel

Code

public function testGlobalContextVariable() {
  $text = 'test {{ @typed_data_global_context_test.simple_test_context:dragons }}';
  $context = $this->simpleTestContext
    ->getRuntimeContexts([
    'dragons',
  ]);
  $result = $this->placeholderResolver
    ->replacePlaceHolders($text, [
    '@typed_data_global_context_test.simple_test_context:dragons' => $context['dragons']
      ->getContextData(),
  ]);
  $this
    ->assertEquals('test Dragons are better than unicorns!', $result);
}