function EntityCreateAccessCustomCidTest::providerTestCustomCid

Provides test cases for ::testCustomCid().

Return value

array[] A list of test cases.

File

core/tests/Drupal/Tests/Core/Entity/Access/EntityCreateAccessCustomCidTest.php, line 250

Class

EntityCreateAccessCustomCidTest
Tests entity access control handler custom internal cache ID.

Namespace

Drupal\Tests\Core\Entity\Access

Code

public static function providerTestCustomCid() : array {
  return [
    'no context var, in cache' => [
      'bundle' => 'bundle_1',
      'context' => [],
      'cid' => 'create:bundle_1',
      'in_cache' => TRUE,
    ],
    'no context var, not in cache' => [
      'bundle' => 'bundle_2',
      'context' => [],
      'cid' => 'create:bundle_2',
      'in_cache' => FALSE,
    ],
    'one context var, in cache' => [
      'bundle' => 'bundle_3',
      'context' => [
        'context_var1' => 'val1',
      ],
      'cid' => 'create:bundle_3:val1',
      'in_cache' => TRUE,
    ],
    'one context var, not in cache' => [
      'bundle' => 'bundle_4',
      'context' => [
        'context_var1' => 'val1',
      ],
      'cid' => 'create:bundle_4:val1',
      'in_cache' => FALSE,
    ],
    'two context vars, in cache' => [
      'bundle' => 'bundle_5',
      'context' => [
        'context_var1' => 'val1',
        'context_var2' => 'val2',
      ],
      'cid' => 'create:bundle_5:val1:val2',
      'in_cache' => TRUE,
    ],
    'two context vars, not in cache' => [
      'bundle' => 'bundle_6',
      'context' => [
        'context_var1' => 'val1',
        'context_var2' => 'val2',
      ],
      'cid' => 'create:bundle_6:val1:val2',
      'in_cache' => FALSE,
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.