function ActionTest::testDependencies
Same name in other branches
- 9 core/modules/system/tests/src/Kernel/Action/ActionTest.php \Drupal\Tests\system\Kernel\Action\ActionTest::testDependencies()
- 8.9.x core/modules/system/tests/src/Kernel/Action/ActionTest.php \Drupal\Tests\system\Kernel\Action\ActionTest::testDependencies()
- 10 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 80
Class
- ActionTest
- Tests action plugins.
Namespace
Drupal\Tests\system\Kernel\ActionCode
public function testDependencies() : void {
// Create a new action that depends on a user role.
$action = Action::create([
'id' => 'user_add_role_action.' . RoleInterface::ANONYMOUS_ID,
'type' => 'user',
'label' => '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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.