function ExpectDeprecationTrait::expectDeprecation
Same name and namespace in other branches
- 11.x core/tests/Drupal/TestTools/Extension/DeprecationBridge/ExpectDeprecationTrait.php \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait::expectDeprecation()
- 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
2 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.
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.