public function DataComparisonTest::testRefineContextDefinitions in Rules 8.3
@covers ::refineContextDefinitions
File
- tests/
src/ Unit/ Integration/ Condition/ DataComparisonTest.php, line 202
Class
- DataComparisonTest
- @coversDefaultClass \Drupal\rules\Plugin\Condition\DataComparison @group RulesCondition
Namespace
Drupal\Tests\rules\Unit\Integration\ConditionCode
public function testRefineContextDefinitions() {
// When a string is selected for comparison, the value must be string also.
$this->condition
->refineContextDefinitions([
'data' => DataDefinition::create('string'),
]);
$this
->assertEquals('string', $this->condition
->getContextDefinition('value')
->getDataType());
// IN operation requires a list of strings as value.
$this->condition
->setContextValue('operation', 'IN');
$this->condition
->refineContextDefinitions([
'data' => DataDefinition::create('string'),
]);
$this
->assertEquals('string', $this->condition
->getContextDefinition('value')
->getDataType());
$this
->assertTrue($this->condition
->getContextDefinition('value')
->isMultiple());
}