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

17 calls to ExpectDeprecationTrait::expectDeprecation()
CKEditor5PluginManagerTest::testDeprecatedIcons in core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
Tests deprecation and backwards compatibility of icon names.
CKEditor5PluginManagerTest::testDerivedPluginDefinitions in core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
Tests derived plugin definitions.
EntityViewsDataTest::testDeprecations in core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php
Tests EntityViewsData deprecations.
ExecutableFinderTest::testLegacyExecutablePaths in core/modules/package_manager/tests/src/Unit/ExecutableFinderTest.php
Tests that the executable finder falls back to looking in config for paths.
HandlerTest::testAccess in core/modules/views/tests/src/Functional/Handler/HandlerTest.php
Tests access to a handler.

... 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.