function ContextHandlerTest::testApplyContextMappingConfigurableAssignedMiss
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php \Drupal\Tests\Core\Plugin\ContextHandlerTest::testApplyContextMappingConfigurableAssignedMiss()
- 10 core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php \Drupal\Tests\Core\Plugin\ContextHandlerTest::testApplyContextMappingConfigurableAssignedMiss()
- 11.x core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php \Drupal\Tests\Core\Plugin\ContextHandlerTest::testApplyContextMappingConfigurableAssignedMiss()
@covers ::applyContextMapping
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ ContextHandlerTest.php, line 535
Class
- ContextHandlerTest
- @coversDefaultClass \Drupal\Core\Plugin\Context\ContextHandler @group Plugin
Namespace
Drupal\Tests\Core\PluginCode
public function testApplyContextMappingConfigurableAssignedMiss() {
$context = $this->createMock('Drupal\\Core\\Plugin\\Context\\ContextInterface');
$context->expects($this->never())
->method('getContextValue');
$contexts = [
'name' => $context,
];
$context_definition = $this->createMock('Drupal\\Core\\Plugin\\Context\\ContextDefinitionInterface');
$plugin = $this->createMock('Drupal\\Tests\\Core\\Plugin\\TestConfigurableContextAwarePluginInterface');
$plugin->expects($this->once())
->method('getContextMapping')
->willReturn([]);
$plugin->expects($this->once())
->method('getContextDefinitions')
->will($this->returnValue([
'hit' => $context_definition,
]));
$plugin->expects($this->never())
->method('setContext');
$this->expectException(ContextException::class);
$this->expectExceptionMessage('Assigned contexts were not satisfied: miss');
$this->contextHandler
->applyContextMapping($plugin, $contexts, [
'miss' => 'name',
]);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.