function EntityCloneConfigActionTest::testFailIfEntityExists

Tests that the action can be configured to fail if the clone exists.

File

core/tests/Drupal/KernelTests/Core/Recipe/EntityCloneConfigActionTest.php, line 79

Class

EntityCloneConfigActionTest
@covers \Drupal\Core\Config\Action\Plugin\ConfigAction\EntityClone @group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testFailIfEntityExists() : void {
    $this->container
        ->get('plugin.manager.config_action')
        ->applyAction('cloneAs', 'user.role.test', [
        'id' => 'cloned',
        'fail_if_exists' => TRUE,
    ]);
    $this->expectException(ConfigActionException::class);
    $this->expectExceptionMessage('Entity user.role.cloned exists');
    $this->container
        ->get('plugin.manager.config_action')
        ->applyAction('cloneAs', 'user.role.test', [
        'id' => 'cloned',
        'fail_if_exists' => TRUE,
    ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.