You are here

public function DoTrustedCallbackTraitTest::providerTestTrustedCallbacks in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::providerTestTrustedCallbacks()
  2. 10 core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::providerTestTrustedCallbacks()

Data provider for ::testTrustedCallbacks().

File

core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php, line 29

Class

DoTrustedCallbackTraitTest
@coversDefaultClass \Drupal\Core\Security\DoTrustedCallbackTrait @group Security

Namespace

Drupal\Tests\Core\Security

Code

public function providerTestTrustedCallbacks() {
  $closure = function () {
    return 'test';
  };
  $tests['closure'] = [
    $closure,
  ];
  $tests['TrustedCallbackInterface_object'] = [
    [
      new TrustedMethods(),
      'callback',
    ],
    TrustedInterface::class,
  ];
  $tests['TrustedCallbackInterface_static_string'] = [
    '\\Drupal\\Tests\\Core\\Security\\TrustedMethods::callback',
    TrustedInterface::class,
  ];
  $tests['TrustedCallbackInterface_static_array'] = [
    [
      TrustedMethods::class,
      'callback',
    ],
    TrustedInterface::class,
  ];
  $tests['extra_trusted_interface_object'] = [
    [
      new TrustedObject(),
      'callback',
    ],
    TrustedInterface::class,
  ];
  $tests['extra_trusted_interface_static_string'] = [
    '\\Drupal\\Tests\\Core\\Security\\TrustedObject::callback',
    TrustedInterface::class,
  ];
  $tests['extra_trusted_interface_static_array'] = [
    [
      TrustedObject::class,
      'callback',
    ],
    TrustedInterface::class,
  ];
  return $tests;
}