function ExpectDeprecationTrait::expectDeprecation
Same name and namespace in other branches
- 8.9.x core/tests/Drupal/Tests/Traits/ExpectDeprecationTrait.php \Drupal\Tests\Traits\ExpectDeprecationTrait::expectDeprecation()
- main core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php \Drupal\TestTools\Extension\DeprecationBridge\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
6 calls to ExpectDeprecationTrait::expectDeprecation()
- 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.
- PhpUnitBridgeTest::testDeprecatedClass in core/
tests/ Drupal/ KernelTests/ Core/ Test/ PhpUnitBridgeTest.php - Tests class deprecation.
- PhpUnitBridgeTest::testDeprecatedFunction in core/
tests/ Drupal/ KernelTests/ Core/ Test/ PhpUnitBridgeTest.php - Tests function deprecation.
- PhpUnitBridgeTest::testErrorOnSiteUnderTest in core/
tests/ Drupal/ FunctionalTests/ Core/ Test/ PhpUnitBridgeTest.php - Tests deprecation message from deprecated route.
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\DeprecationBridgeCode
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.