You are here

public function ContextTypedDataTest::testHasContextValue in Drupal 10

@covers ::hasContextValue @dataProvider providerHasContextValue

File

core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php, line 84

Class

ContextTypedDataTest
Tests that contexts work properly with the typed data manager.

Namespace

Drupal\KernelTests\Core\Plugin

Code

public function testHasContextValue($has_context_value, $default_value) : void {
  $definition = new ContextDefinition('any');
  $definition
    ->setDefaultValue($default_value);
  $context = new Context($definition);
  $this
    ->assertSame($has_context_value, $context
    ->hasContextValue());
  $this
    ->assertSame($default_value, $context
    ->getContextValue());
}