function ExpectDeprecationTrait::expectDeprecation

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait::expectDeprecation()
  2. 8.9.x core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php \Drupal\Tests\Traits\ExpectDeprecationTrait::expectDeprecation()

Adds an expected deprecation.

Parameters

string $message: The expected deprecation message.

Deprecated

in drupal:11.4.0 and is removed from drupal:12.0.0. Use $this->expectUserDeprecationMessage() or $this->expectUserDeprecationMessageMatches() instead.

See also

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

32 calls to ExpectDeprecationTrait::expectDeprecation()
BcEngineTest::testPage in core/modules/system/tests/src/Functional/Theme/BcEngineTest.php
Tests that .engine theme engines still work.
ExpectDeprecationTest::testExpectDeprecation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
Tests expectDeprecation.
ExpectDeprecationTest::testExpectDeprecationInIsolation in core/tests/Drupal/Tests/ExpectDeprecationTest.php
Tests expectDeprecation in isolated test.
ExtensionMimeTypeGuesserDeprecationTest::testConstructorDeprecation in core/tests/Drupal/KernelTests/Core/File/ExtensionMimeTypeGuesserDeprecationTest.php
Tests that deprecations are raised for missing constructor arguments.
ExtensionMimeTypeGuesserLegacyTest::testFileMimeTypeDetectionCustomMapping in core/tests/Drupal/KernelTests/Core/File/MimeType/ExtensionMimeTypeGuesserLegacyTest.php
Tests mapping of mimetypes from filenames.

... See full list

File

core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php, line 39

Class

ExpectDeprecationTrait
A trait to include in Drupal tests to manage expected deprecations.

Namespace

Drupal\TestTools\Extension\DeprecationBridge

Code

public function expectDeprecation(string $message) : void {
  @trigger_error('expectDeprecation() is deprecated in drupal:11.4.0 and is removed from drupal:12.0.0. Use $this->expectUserDeprecationMessage() or $this->expectUserDeprecationMessageMatches() instead. See https://www.drupal.org/node/3545276', E_USER_DEPRECATED);
  $this->expectUserDeprecationMessageMatches($this->regularExpressionForFormatDescription('%A' . $message . '%A'));
}

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