You are here

public function EntitySaveTest::testActionExecutionImmediately in Rules 8.3

Tests the action execution when saving immediately.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/EntitySaveTest.php, line 53

Class

EntitySaveTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\EntitySave @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testActionExecutionImmediately() {
  $this->entity
    ->save()
    ->shouldBeCalledTimes(1);
  $this->action
    ->setContextValue('entity', $this->entity
    ->reveal())
    ->setContextValue('immediate', TRUE);
  $this->action
    ->execute();
  $this
    ->assertEquals($this->action
    ->autoSaveContext(), [], 'Action returns nothing for auto saving since the entity has been saved already.');
}