function DeprecationHandler::expectDeprecation

Adds an expected deprecation.

Tests will expect deprecations during the test execution; at the end of each test run, collected deprecations are checked against the expected ones.

Parameters

string $message: The expected deprecation message.

1 call to DeprecationHandler::expectDeprecation()
ExpectDeprecationTrait::expectDeprecation in core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php
Adds an expected deprecation.

File

core/tests/Drupal/TestTools/Extension/DeprecationBridge/DeprecationHandler.php, line 152

Class

DeprecationHandler
Drupal's PHPUnit extension to manage code deprecation.

Namespace

Drupal\TestTools\Extension\DeprecationBridge

Code

public static function expectDeprecation(string $message) : void {
    if (!self::isEnabled()) {
        return;
    }
    self::$expectedDeprecations[] = $message;
}

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