function DoTrustedCallbackTraitTest::testStaticTrustedCallbackHelperWithDeprecatedArg

Same name and namespace in other branches
  1. main core/tests/Drupal/Tests/Core/Security/DoTrustedCallbackTraitTest.php \Drupal\Tests\Core\Security\DoTrustedCallbackTraitTest::testStaticTrustedCallbackHelperWithDeprecatedArg()

Tests StaticTrustedCallbackHelper::callback() argument deprecation.

Attributes

#[DataProvider('providerTestTrustedCallbacks')] #[IgnoreDeprecations]

File

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

Class

DoTrustedCallbackTraitTest
Tests Drupal\Core\Security\DoTrustedCallbackTrait.

Namespace

Drupal\Tests\Core\Security

Code

public function testStaticTrustedCallbackHelperWithDeprecatedArg(callable $callback, $extra_trusted_interface = NULL) : void {
  $this->expectUserDeprecationMessage('Calling Drupal\\Core\\Security\\StaticTrustedCallbackHelper::callback() with 5 arguments is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. See https://www.drupal.org/node/3627046');
  $return = StaticTrustedCallbackHelper::callback($callback, [], '%s is not trusted', 'exception', $extra_trusted_interface);
  $this->assertSame('test', $return);
}

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