EntityCloneShortcutSetTest.php in Entity Clone 8
File
tests/src/Functional/EntityCloneShortcutSetTest.php
View source
<?php
namespace Drupal\Tests\entity_clone\Functional;
use Drupal\shortcut\Entity\ShortcutSet;
use Drupal\Tests\BrowserTestBase;
class EntityCloneShortcutSetTest extends BrowserTestBase {
public static $modules = [
'entity_clone',
'shortcut',
];
protected $defaultTheme = 'classy';
protected $permissions = [
'clone shortcut_set entity',
];
protected $adminUser;
protected function setUp() : void {
parent::setUp();
$this->adminUser = $this
->drupalCreateUser($this->permissions);
$this
->drupalLogin($this->adminUser);
}
public function testShortcutSetEntityClone() {
$edit = [
'id' => 'test_shortcut_set_cloned',
'label' => 'Test shortcut set cloned',
];
$this
->drupalPostForm('entity_clone/shortcut_set/default', $edit, t('Clone'));
$shortcut_sets = \Drupal::entityTypeManager()
->getStorage('shortcut_set')
->loadByProperties([
'id' => $edit['id'],
]);
$shortcut_set = reset($shortcut_sets);
$this
->assertInstanceOf(ShortcutSet::class, $shortcut_set, 'Test default shortcut set cloned found in database.');
}
}