function EntityCloneConfigActionTest::testNoErrorWithExistingEntity
Tests no error is thrown when an entity with the same ID already exists.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ EntityCloneConfigActionTest.php, line 64
Class
- EntityCloneConfigActionTest
- @covers \Drupal\Core\Config\Action\Plugin\ConfigAction\EntityClone @group Recipe
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testNoErrorWithExistingEntity() : void {
$this->createRole([
'administer site configuration',
], 'cloned');
$this->container
->get('plugin.manager.config_action')
->applyAction('cloneAs', 'user.role.test', 'cloned');
$clone = Role::load('cloned');
$this->assertInstanceOf(Role::class, $clone);
$this->assertTrue($clone->hasPermission('administer site configuration'));
$this->assertFalse($clone->hasPermission('access user profiles'));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.