function FormBuilderTest::providerTestFormTokenCacheability

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::providerTestFormTokenCacheability()
  2. 10 core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php \Drupal\Tests\Core\Form\FormBuilderTest::providerTestFormTokenCacheability()
  3. 11.x 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 934

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',
        ],
    ];
}

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