You are here

protected function ExpectDeprecationTrait::addExpectedDeprecationMessage in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php \Drupal\Tests\Traits\ExpectDeprecationTrait::addExpectedDeprecationMessage()

Sets an expected deprecation message.

Parameters

string $message: The expected deprecation message.

2 calls to ExpectDeprecationTrait::addExpectedDeprecationMessage()
ExpectDeprecationTest::testExpectDeprecation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
@covers ::addExpectedDeprecationMessage
ExpectDeprecationTest::testExpectDeprecationInIsolation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
@covers ::addExpectedDeprecationMessage @runInSeparateProcess @preserveGlobalState disabled

File

core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php, line 23

Class

ExpectDeprecationTrait
Adds the ability to dynamically set expected deprecation messages in tests.

Namespace

Drupal\Tests\Traits

Code

protected function addExpectedDeprecationMessage($message) {
  @trigger_error(__METHOD__ . '() is deprecated in drupal:9.1.0 and is removed from drupal:10.0.0. Use \\Symfony\\Bridge\\PhpUnit\\ExpectDeprecationTrait::expectDeprecation() instead. See https://www.drupal.org/node/3161901', E_USER_DEPRECATED);
  $this
    ->expectDeprecation($message);
}