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 \Drupal\Core\Form\ConfigTarget[[api-linebreak]] @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.