You are here

public function EntityOperationsTest::testEntityOperationAlter in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/EntityOperationsTest.php \Drupal\system\Tests\Entity\EntityOperationsTest::testEntityOperationAlter()

Checks that hook_entity_operation_alter() can add an operation.

See also

entity_test_entity_operation_alter()

File

core/modules/system/src/Tests/Entity/EntityOperationsTest.php, line 38
Contains \Drupal\system\Tests\Entity\EntityOperationsTest.

Class

EntityOperationsTest
Tests that operations can be injected from the hook.

Namespace

Drupal\system\Tests\Entity

Code

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
      ->assertLinkByHref($role
      ->url() . '/test_operation');
    $this
      ->assertLink(format_string('Test Operation: @label', array(
      '@label' => $role
        ->label(),
    )));
  }
}