function ContextTypedDataTest::testHasContextValue

Same name in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\ContextTypedDataTest::testHasContextValue()
  2. 11.x core/tests/Drupal/KernelTests/Core/Plugin/ContextTypedDataTest.php \Drupal\KernelTests\Core\Plugin\ContextTypedDataTest::testHasContextValue()

@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());
}

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