function EntitySaveTest::testActionExecutionImmediately

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.');
}