You are here

public function AuthcacheEnumCartesianTestCase::testCombineK in Authenticated User Page Caching (Authcache) 7.2

Test calculation of the cartesian product.

File

modules/authcache_enum/lib/Drupal/authcache_enum/Tests/AuthcacheEnumCartesianTestCase.php, line 37
Defines a test case covering _authcache_enum_cartesian.

Class

AuthcacheEnumCartesianTestCase
Unit tests for _authcache_enum_comb.

Namespace

Drupal\authcache_enum\Tests

Code

public function testCombineK() {
  $template = array(
    'x' => array(
      1,
      2,
      3,
    ),
    'y' => array(
      'a',
      'b',
    ),
  );
  $expect = array(
    array(
      'x' => 1,
      'y' => 'a',
    ),
    array(
      'x' => 2,
      'y' => 'a',
    ),
    array(
      'x' => 3,
      'y' => 'a',
    ),
    array(
      'x' => 1,
      'y' => 'b',
    ),
    array(
      'x' => 2,
      'y' => 'b',
    ),
    array(
      'x' => 3,
      'y' => 'b',
    ),
  );
  $result = _authcache_enum_cartesian($template);
  $this
    ->assertEqual($expect, $result);
}