You are here

public function ExpectDeprecationTrait::expectedDeprecations in Drupal 9

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

Sets expected deprecation messages.

Parameters

string[] $messages: The expected deprecation messages.

See also

\Symfony\Bridge\PhpUnit\Legacy\ExpectDeprecationTraitForV8_4::expectDeprecation()

1 call to ExpectDeprecationTrait::expectedDeprecations()
ExpectDeprecationTest::testExpectDeprecationInIsolation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
@covers ::addExpectedDeprecationMessage @runInSeparateProcess @preserveGlobalState disabled

File

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

Class

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

Namespace

Drupal\Tests\Traits

Code

public function expectedDeprecations(array $messages) {
  @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);
  foreach ($messages as $message) {
    $this
      ->expectDeprecation($message);
  }
}