function EntityOperationsTest::testEntityOperationAlter
Same name in other branches
- 9 core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php \Drupal\Tests\system\Functional\Entity\EntityOperationsTest::testEntityOperationAlter()
- 8.9.x core/modules/system/tests/src/Functional/Entity/EntityOperationsTest.php \Drupal\Tests\system\Functional\Entity\EntityOperationsTest::testEntityOperationAlter()
- 11.x 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 43
Class
- EntityOperationsTest
- Tests that operations can be injected from the hook.
Namespace
Drupal\Tests\system\Functional\EntityCode
public function testEntityOperationAlter() : void {
// Check that role listing contain our test_operation operation.
$this->drupalGet('admin/people/roles');
$roles = Role::loadMultiple();
foreach ($roles as $role) {
$this->assertSession()
->linkByHrefExists($role->toUrl()
->toString() . '/test_operation');
$this->assertSession()
->linkExists(new FormattableMarkup('Test Operation: @label', [
'@label' => $role->label(),
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.