function DataComparisonTest::testConditionEvaluationOperatorLessThan

Tests evaluating the condition with the "is less than" operation.

@covers ::evaluate

File

tests/src/Unit/Integration/Condition/DataComparisonTest.php, line 149

Class

DataComparisonTest
@coversDefaultClass \Drupal\rules\Plugin\Condition\DataComparison @group RulesCondition

Namespace

Drupal\Tests\rules\Unit\Integration\Condition

Code

public function testConditionEvaluationOperatorLessThan() {
    // Test that when data is less than value and operation is '<',
    // TRUE is returned.
    $this->condition
        ->setContextValue('data', 1)
        ->setContextValue('operation', '<')
        ->setContextValue('value', 2);
    $this->assertTrue($this->condition
        ->evaluate());
    // Test that when data is greater than value and operation is '<',
    // FALSE is returned.
    $this->condition
        ->setContextValue('data', 2)
        ->setContextValue('operation', '<')
        ->setContextValue('value', 1);
    $this->assertFalse($this->condition
        ->evaluate());
}