function DoTrustedCallbackTraitTest::providerTestTrustedCallbacks

Same name in other branches
  1. 9 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()
  3. 11.x 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 30

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;
}

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