function DoTrustedCallbackTraitTest::testException

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

Tests exception.

Attributes

#[DataProvider('errorTypeProvider')]

File

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

Class

DoTrustedCallbackTraitTest
Tests Drupal\Core\Security\DoTrustedCallbackTrait.

Namespace

Drupal\Tests\Core\Security

Code

public function testException($callback) : void {
  $this->expectException(UntrustedCallbackException::class);
  $this->expectExceptionMessage('Drupal\\Tests\\Core\\Security\\UntrustedObject::callback is not trusted');
  $this->doTrustedCallback($callback, [], '%s is not trusted');
}

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