You are here

public function FormBuilderTest::providerTestFormTokenCacheability in Drupal 10

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

Data provider for testFormTokenCacheability.

Return value

array

File

core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php, line 921
Contains \Drupal\Tests\Core\Form\FormBuilderTest.

Class

FormBuilderTest
@coversDefaultClass \Drupal\Core\Form\FormBuilder @group Form

Namespace

Drupal\Tests\Core\Form

Code

public function providerTestFormTokenCacheability() {
  return [
    'token:none,authenticated:true' => [
      NULL,
      TRUE,
      [
        'contexts' => [
          'user.roles:authenticated',
        ],
      ],
      [
        'max-age' => 0,
      ],
      'post',
    ],
    'token:none,authenticated:false' => [
      NULL,
      FALSE,
      [
        'contexts' => [
          'user.roles:authenticated',
        ],
      ],
      NULL,
      'post',
    ],
    'token:false,authenticated:false' => [
      FALSE,
      FALSE,
      NULL,
      NULL,
      'post',
    ],
    'token:false,authenticated:true' => [
      FALSE,
      TRUE,
      NULL,
      NULL,
      'post',
    ],
    'token:none,authenticated:false,method:get' => [
      NULL,
      FALSE,
      [
        'contexts' => [
          'user.roles:authenticated',
        ],
      ],
      NULL,
      'get',
    ],
    'token:test_form_id,authenticated:false,method:get' => [
      'test_form_id',
      TRUE,
      [
        'contexts' => [
          'user.roles:authenticated',
        ],
      ],
      [
        'max-age' => 0,
      ],
      'get',
    ],
  ];
}