public function TextComparisonTest::testConditionEvaluationOperatorEnds in Rules 8.3
Tests evaluating the condition with the "ends" operator.
@covers ::evaluate
File
- tests/
src/ Unit/ Integration/ Condition/ TextComparisonTest.php, line 57
Class
- TextComparisonTest
- @coversDefaultClass \Drupal\rules\Plugin\Condition\TextComparison @group RulesCondition
Namespace
Drupal\Tests\rules\Unit\Integration\ConditionCode
public function testConditionEvaluationOperatorEnds() {
// Test that when the text string ends with the match string and
// the operator is 'ends', TRUE is returned.
$this->condition
->setContextValue('text', 'my-text')
->setContextValue('operator', 'ends')
->setContextValue('match', 'text');
$this
->assertTrue($this->condition
->evaluate());
// Test that when the text string does not end with the match string and
// the operator is 'ends', FALSE is returned.
$this->condition
->setContextValue('text', 'my-text')
->setContextValue('operator', 'ends')
->setContextValue('match', 'my');
$this
->assertFalse($this->condition
->evaluate());
}