You are here

public function EntityOperationsTest::testEntityOperations in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/EntityOperationsTest.php \Drupal\Tests\group\Functional\EntityOperationsTest::testEntityOperations()

Checks for entity operations under given circumstances.

@parem array $visible A list of visible link labels, keyed by path. @parem array $invisible A list of invisible link labels, keyed by path.

@dataProvider provideEntityOperationScenarios

Parameters

string[] $permissions: A list of group permissions to assign to the user.

string[] $modules: A list of modules to enable.

File

tests/src/Functional/EntityOperationsTest.php, line 28

Class

EntityOperationsTest
Tests that entity operations (do not) show up on the group overview.

Namespace

Drupal\Tests\group\Functional

Code

public function testEntityOperations($visible, $invisible, $permissions = [], $modules = []) {
  $group = $this
    ->createGroup();
  if (!empty($permissions)) {
    $role = $group
      ->getGroupType()
      ->getMemberRole();
    $role
      ->grantPermissions($permissions);
    $role
      ->save();
  }
  if (!empty($modules)) {
    $this->container
      ->get('module_installer')
      ->install($modules, TRUE);
  }
  $this
    ->drupalGet('admin/group');
  foreach ($visible as $path => $label) {
    $this
      ->assertSession()
      ->linkExists($label);
    $this
      ->assertSession()
      ->linkByHrefExists($path);
  }
  foreach ($invisible as $path => $label) {
    $this
      ->assertSession()
      ->linkNotExists($label);
    $this
      ->assertSession()
      ->linkByHrefNotExists($path);
  }
}