You are here

private static function OverrideNodeOptionsTest::combinations in Override Node Options 7

Helper function that generates combinations.

1 call to OverrideNodeOptionsTest::combinations()
OverrideNodeOptionsTest::testNodeOptions in src/Tests/Functional/OverrideNodeOptionsTest.php
Test the 'Authoring information' fieldset.

File

src/Tests/Functional/OverrideNodeOptionsTest.php, line 98
Unit tests for the override_node_options module.

Class

OverrideNodeOptionsTest
Defines a base class for testing the Override Node Options module.

Namespace

Drupal\override_node_options\Tests\Functional

Code

private static function combinations($values, $length, $start = 0) {
  $results = array();
  if ($start < $length) {
    $inner = self::combinations($values, $length, $start + 1) ?: array(
      array(),
    );
    foreach ($values as $value) {
      foreach ($inner as $result) {
        $results[] = array_merge(array(
          $value,
        ), $result);
      }
    }
  }
  return $results;
}