public function EntityOperationsTest::testEntityOperationAlter in Drupal 10
Same name and namespace in other branches
- 8 core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php \Drupal\Tests\system\Functional\Entity\EntityOperationsTest::testEntityOperationAlter()
- 9 core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php \Drupal\Tests\system\Functional\Entity\EntityOperationsTest::testEntityOperationAlter()
Checks that hook_entity_operation_alter() can add an operation.
See also
entity_test_entity_operation_alter()
File
- core/
modules/ system/ tests/ src/ Functional/ Entity/ EntityOperationsTest.php, line 39
Class
- EntityOperationsTest
- Tests that operations can be injected from the hook.
Namespace
Drupal\Tests\system\Functional\EntityCode
public function testEntityOperationAlter() {
// Check that role listing contain our test_operation operation.
$this
->drupalGet('admin/people/roles');
$roles = user_roles();
foreach ($roles as $role) {
$this
->assertSession()
->linkByHrefExists($role
->toUrl()
->toString() . '/test_operation');
$this
->assertSession()
->linkExists(new FormattableMarkup('Test Operation: @label', [
'@label' => $role
->label(),
]));
}
}