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