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 85 
Class
- EntityCloneConfigActionTest
- Tests Entity Clone Config Action.
Namespace
Drupal\KernelTests\Core\RecipeCode
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.
