You are here

private function ApiProductAccessTest::calculateTestCombinations in Apigee Edge 8

Calculates test combination from roles and product visibility options.

Return value

array Multidimensional array with all possible combinations.

1 call to ApiProductAccessTest::calculateTestCombinations()
ApiProductAccessTest::entityAccessTest in tests/src/FunctionalJavascript/ApiProductAccessTest.php
Tests "Access by visibility" access control.

File

tests/src/FunctionalJavascript/ApiProductAccessTest.php, line 390

Class

ApiProductAccessTest
Validates built-in access control on API products.

Namespace

Drupal\Tests\apigee_edge\FunctionalJavascript

Code

private function calculateTestCombinations() : array {
  $ridCombinations = $this->ridCombinations;
  $visibilityCombinations = [
    [],
  ];
  foreach (self::VISIBILITIES as $visibility) {
    foreach ($visibilityCombinations as $visibilityCombination) {
      array_push($visibilityCombinations, array_merge([
        $visibility,
      ], $visibilityCombination));
    }
  }

  // Do not test the empty matrix (roles * visibility) times.
  array_shift($ridCombinations);
  array_shift($visibilityCombinations);

  // Only test it once.
  $visibilityCombinations[] = [];
  return $visibilityCombinations;
}