function DoTrustedCallbackTraitTest::testUntrustedCallbacks

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::testUntrustedCallbacks()
  2. 8.9.x core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::testUntrustedCallbacks()
  3. 10 core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::testUntrustedCallbacks()

@covers ::doTrustedCallback @dataProvider providerTestUntrustedCallbacks

File

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

Class

DoTrustedCallbackTraitTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Security%21DoTrustedCallbackTrait.php/trait/DoTrustedCallbackTrait/11.x" title="Ensures that only predefined methods can be used as callback methods." class="local">\Drupal\Core\Security\DoTrustedCallbackTrait</a> @group Security

Namespace

Drupal\Tests\Core\Security

Code

public function testUntrustedCallbacks(callable $callback, $extra_trusted_interface = NULL) : void {
    $this->expectException(UntrustedCallbackException::class);
    $this->doTrustedCallback($callback, [], '%s is not trusted', TrustedCallbackInterface::THROW_EXCEPTION, $extra_trusted_interface);
}

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