function ContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy()
- 10 core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy()
- 11.x core/tests/Drupal/Tests/Core/Plugin/Context/ContextDefinitionIsSatisfiedTest.php \Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest::providerTestIsSatisfiedBy()
Provides test data for ::testIsSatisfiedBy().
File
-
core/
tests/ Drupal/ Tests/ Core/ Plugin/ Context/ ContextDefinitionIsSatisfiedTest.php, line 83
Class
- ContextDefinitionIsSatisfiedTest
- @coversDefaultClass \Drupal\Core\Plugin\Context\ContextDefinition @group Plugin
Namespace
Drupal\Tests\Core\Plugin\ContextCode
public function providerTestIsSatisfiedBy() {
$data = [];
// Simple data types.
$data['both any'] = [
TRUE,
new ContextDefinition('any'),
new ContextDefinition('any'),
];
$data['requirement any'] = [
TRUE,
new ContextDefinition('any'),
new ContextDefinition('integer'),
];
$data['integer, out of range'] = [
FALSE,
(new ContextDefinition('integer'))->addConstraint('Range', [
'min' => 0,
'max' => 10,
]),
new ContextDefinition('integer'),
20,
];
$data['integer, within range'] = [
TRUE,
(new ContextDefinition('integer'))->addConstraint('Range', [
'min' => 0,
'max' => 10,
]),
new ContextDefinition('integer'),
5,
];
$data['integer, no value'] = [
TRUE,
(new ContextDefinition('integer'))->addConstraint('Range', [
'min' => 0,
'max' => 10,
]),
new ContextDefinition('integer'),
];
$data['non-integer, within range'] = [
FALSE,
(new ContextDefinition('integer'))->addConstraint('Range', [
'min' => 0,
'max' => 10,
]),
new ContextDefinition('any'),
5,
];
// Inherited context definition class.
$data['both any, inherited context requirement definition'] = [
TRUE,
new InheritedContextDefinition('any'),
new ContextDefinition('any'),
];
$data['specific definition, generic requirement'] = [
TRUE,
new ContextDefinition('test_data_type'),
new ContextDefinition('test_data_type:a_variant'),
];
$data['generic definition, specific requirement'] = [
FALSE,
new ContextDefinition('test_data_type:a_variant'),
new ContextDefinition('test_data_type'),
];
return $data;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.