function ContextTest::testHasContextValue
@covers ::hasContextValue
@dataProvider providerHasContextValue
File
-
core/
tests/ Drupal/ Tests/ Component/ Plugin/ Context/ ContextTest.php, line 103
Class
- ContextTest
- @coversDefaultClass \Drupal\Component\Plugin\Context\Context[[api-linebreak]] @group Plugin
Namespace
Drupal\Tests\Component\Plugin\ContextCode
public function testHasContextValue($has_context_value, $default_value) : void {
$mock_definition = $this->createMock('Drupal\\Component\\Plugin\\Context\\ContextDefinitionInterface');
$mock_definition->expects($this->atLeastOnce())
->method('getDefaultValue')
->willReturn($default_value);
$context = new Context($mock_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.