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

File

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

Class

FormBuilderTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21FormBuilder.php/class/FormBuilder/11.x" title="Provides form building and processing." class="local">\Drupal\Core\Form\FormBuilder</a> @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.