public function ActionTest::testDependencies in Drupal 9
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Kernel/Action/ActionTest.php \Drupal\Tests\system\Kernel\Action\ActionTest::testDependencies()
Tests the dependency calculation of actions.
File
- core/
modules/ system/ tests/ src/ Kernel/ Action/ ActionTest.php, line 78
Class
- ActionTest
- Tests action plugins.
Namespace
Drupal\Tests\system\Kernel\ActionCode
public function testDependencies() {
// Create a new action that depends on a user role.
$action = Action::create([
'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
'type' => 'user',
'label' => t('Add the anonymous role to the selected users'),
'configuration' => [
'rid' => RoleInterface::ANONYMOUS_ID,
],
'plugin' => 'user_add_role_action',
]);
$action
->save();
$expected = [
'config' => [
'user.role.' . RoleInterface::ANONYMOUS_ID,
],
'module' => [
'user',
],
];
$this
->assertSame($expected, $action
->calculateDependencies()
->getDependencies());
}