function RuleExpressionTest::testSetConditionsGetConditions

Tests the condition container setter and getter.

@covers ::setConditions @covers ::getConditions

File

tests/src/Unit/RuleExpressionTest.php, line 82

Class

RuleExpressionTest
@coversDefaultClass \Drupal\rules\Plugin\RulesExpression\RuleExpression @group Rules

Namespace

Drupal\Tests\rules\Unit

Code

public function testSetConditionsGetConditions() {
    $or = new OrExpression([], 'rules_or', [
        'label' => 'Condition set (OR)',
    ], $this->expressionManager
        ->reveal(), $this->rulesDebugLogger
        ->reveal());
    $this->rule
        ->setConditions($or);
    $this->assertSame($or, $this->rule
        ->getConditions());
    $and = new AndExpression([], 'rules_and', [
        'label' => 'Condition set (AND)',
    ], $this->expressionManager
        ->reveal(), $this->rulesDebugLogger
        ->reveal());
    $this->rule
        ->setConditions($and);
    $this->assertSame($and, $this->rule
        ->getConditions());
}