function FormBuilderTest::providerTestFormTokenCacheability

Same name 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. 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 958

Class

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

Namespace

Drupal\Tests\Core\Form

Code

public static function providerTestFormTokenCacheability() {
    return [
        'token:none,authenticated:true' => [
            NULL,
            TRUE,
            [
                'contexts' => [
                    'user.roles:authenticated',
                ],
                'tags' => [
                    'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:form',
                ],
            ],
            [
                'max-age' => 0,
            ],
            'post',
        ],
        'token:none,authenticated:false' => [
            NULL,
            FALSE,
            [
                'contexts' => [
                    'user.roles:authenticated',
                ],
                'tags' => [
                    'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:form',
                ],
            ],
            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',
                ],
                'tags' => [
                    'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:form',
                ],
            ],
            NULL,
            'get',
        ],
        'token:test_form_id,authenticated:false,method:get' => [
            'test_form_id',
            TRUE,
            [
                'contexts' => [
                    'user.roles:authenticated',
                ],
                'tags' => [
                    'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:form',
                ],
            ],
            [
                'max-age' => 0,
            ],
            'get',
        ],
    ];
}

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