You are here

public function EntityIsNewTest::testConditionEvaluation in Rules 8.3

Tests evaluating the condition.

@covers ::evaluate

File

tests/src/Unit/Integration/Condition/EntityIsNewTest.php, line 34

Class

EntityIsNewTest
@coversDefaultClass \Drupal\rules\Plugin\Condition\EntityIsNew @group RulesCondition

Namespace

Drupal\Tests\rules\Unit\Integration\Condition

Code

public function testConditionEvaluation() {
  $entity = $this
    ->prophesizeEntity(EntityInterface::class);
  $entity
    ->isNew()
    ->willReturn(TRUE)
    ->shouldBeCalledTimes(1);

  // Add the test node to our context as the evaluated entity.
  $this->condition
    ->setContextValue('entity', $entity
    ->reveal());
  $this
    ->assertTrue($this->condition
    ->evaluate());
}