function ExpectDeprecationTrait::expectDeprecation

Same name in other branches
  1. 11.x core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait::expectDeprecation()

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);
}

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