function RulesConditionContainerTest::testDeletingCondition
Tests deleting a condition from the container.
File
-
tests/
src/ Unit/ RulesConditionContainerTest.php, line 129
Class
- RulesConditionContainerTest
- @coversDefaultClass \Drupal\rules\Engine\ConditionExpressionContainer @group Rules
Namespace
Drupal\Tests\rules\UnitCode
public function testDeletingCondition() {
$container = $this->getMockForAbstractClass(RulesConditionContainerTestStub::class, [
[],
'test_id',
[],
$this->prophesize(ExpressionManagerInterface::class)
->reveal(),
$this->prophesize(LoggerChannelInterface::class)
->reveal(),
], '', TRUE);
$container->addExpressionObject($this->trueConditionExpression
->reveal());
$container->addExpressionObject($this->falseConditionExpression
->reveal());
// Delete the first condition.
$uuid = $this->trueConditionExpression
->reveal()
->getUuid();
$this->assertTrue($container->deleteExpression($uuid));
foreach ($container as $condition) {
$this->assertSame($this->falseConditionExpression
->reveal(), $condition);
}
$this->assertFalse($container->deleteExpression('invalid UUID'));
}