function PathAliasCreateTest::testActionExecutionWithLanguage

Tests the action execution when a language is specified.

@covers ::execute

File

tests/src/Unit/Integration/RulesAction/PathAliasCreateTest.php, line 81

Class

PathAliasCreateTest
@coversDefaultClass \Drupal\rules\Plugin\RulesAction\PathAliasCreate @group RulesAction

Namespace

Drupal\Tests\rules\Unit\Integration\RulesAction

Code

public function testActionExecutionWithLanguage() {
    $path_alias = $this->prophesizeEntity(PathAliasInterface::class);
    $path_alias->save()
        ->shouldBeCalledTimes(1);
    $language = $this->prophesize(LanguageInterface::class);
    $language->getId()
        ->willReturn('en');
    $this->aliasStorage
        ->create([
        'path' => '/node/1',
        'alias' => '/about',
        'langcode' => 'en',
    ])
        ->willReturn($path_alias->reveal())
        ->shouldBeCalledTimes(1);
    $this->action
        ->setContextValue('source', '/node/1')
        ->setContextValue('alias', '/about')
        ->setContextValue('language', $language->reveal());
    $this->action
        ->execute();
}