function ConfigTargetTest::providerTestFormCacheable

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php \Drupal\Tests\Core\Form\ConfigTargetTest::providerTestFormCacheable()

File

core/tests/Drupal/Tests/Core/Form/ConfigTargetTest.php, line 100

Class

ConfigTargetTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Form%21ConfigTarget.php/class/ConfigTarget/10" title="Represents the mapping of a config property to a form element." class="local">\Drupal\Core\Form\ConfigTarget</a> @group Form

Namespace

Drupal\Tests\Core\Form

Code

public static function providerTestFormCacheable() : array {
    $closure = fn(bool $something): string => $something ? 'Yes' : 'No';
    return [
        'No callables' => [
            TRUE,
            NULL,
            NULL,
        ],
        'Serializable fromConfig callable' => [
            TRUE,
            "intval",
            NULL,
        ],
        'Serializable toConfig callable' => [
            TRUE,
            NULL,
            "boolval",
        ],
        'Serializable callables' => [
            TRUE,
            "intval",
            "boolval",
        ],
        'Unserializable fromConfig callable' => [
            FALSE,
            $closure,
            NULL,
        ],
        'Unserializable toConfig callable' => [
            FALSE,
            NULL,
            $closure,
        ],
        'Unserializable callables' => [
            FALSE,
            $closure,
            $closure,
        ],
    ];
}

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