You are here

protected function ExpectDeprecationTrait::expectDeprecation in Drupal 8

Sets an expected deprecation message.

Parameters

string $message: The expected deprecation message.

Deprecated

in drupal:8.8.5 and is removed from drupal:9.0.0. Use ::addExpectedDeprecationMessage() instead.

See also

https://www.drupal.org/node/3106024

1 call to ExpectDeprecationTrait::expectDeprecation()
ExpectDeprecationTest::testDeprecatedExpectDeprecation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
@covers ::expectDeprecation

File

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

Class

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

Namespace

Drupal\Tests\Traits

Code

protected function expectDeprecation($message) {
  if (strpos($message, 'ExpectDeprecationTrait::expectDeprecation') === FALSE) {
    @trigger_error('ExpectDeprecationTrait::expectDeprecation is deprecated in drupal:8.8.5 and is removed from drupal:9.0.0. Use ::addExpectedDeprecationMessage() instead. See https://www.drupal.org/node/3106024', E_USER_DEPRECATED);
  }
  $this
    ->addExpectedDeprecationMessage($message);
}