You are here

public function IntegrationTest::getUserWarningRole in Acquia Content Hub 8

Returns list of the roles with security implications.

Return value

array Array of roles.

1 call to IntegrationTest::getUserWarningRole()
IntegrationTest::testFramework in tests/src/Functional/IntegrationTest.php
Tests various operations via the Acquia Content Hub admin UI.

File

tests/src/Functional/IntegrationTest.php, line 424

Class

IntegrationTest
Tests the overall functionality of the Acquia Content Hub module.

Namespace

Drupal\Tests\acquia_contenthub\Functional

Code

public function getUserWarningRole() {
  $markup = $this
    ->xpath('//div[@id="user-warning-role"]');
  $states = (array) json_decode($markup[0]['data-drupal-states']);
  $visible_roles = [];
  if (isset($states['visible'])) {
    foreach ($states['visible'] as $state) {
      $visible_role = (array) $state;
      $visible_roles[] = $visible_role[':input[name="user_role"]']->value;
    }
    return array_flip($visible_roles);
  }
  return [];
}