function FormBuilderTest::providerTestFormTokenCacheability

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::providerTestFormTokenCacheability()
  2. 8.9.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::providerTestFormTokenCacheability()
  3. 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::providerTestFormTokenCacheability()

Data provider for testFormTokenCacheability.

Return value

array An array of test cases, each containing a form token, the authentication, request method, and expected cacheability outcome.

File

core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php, line 993

Class

FormBuilderTest
@coversDefaultClass \Drupal\Core\Form\FormBuilder[[api-linebreak]] @group Form

Namespace

Drupal\Tests\Core\Form

Code

public static function providerTestFormTokenCacheability() {
  return [
    'token:none,authenticated:true' => [
      NULL,
      TRUE,
      'post',
      FALSE,
    ],
    'token:none,authenticated:true,opted_in_for_cache' => [
      NULL,
      TRUE,
      'post',
      TRUE,
    ],
    'token:none,authenticated:false' => [
      NULL,
      FALSE,
      'post',
      FALSE,
    ],
    'token:false,authenticated:false' => [
      FALSE,
      FALSE,
      'post',
      FALSE,
    ],
    'token:false,authenticated:true' => [
      FALSE,
      TRUE,
      'post',
      FALSE,
    ],
    'token:none,authenticated:false,method:get' => [
      NULL,
      FALSE,
      'get',
      FALSE,
    ],
    'token:test_form_id,authenticated:false,method:get' => [
      'test_form_id',
      TRUE,
      'get',
      FALSE,
    ],
  ];
}

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