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

105 calls to ExpectDeprecationTrait::expectDeprecation()
AjaxCommandsTest::testOpenDialogCommandClass in core/tests/Drupal/Tests/Core/Ajax/AjaxCommandsTest.php
Tests dialogClass for OpenDialogCommand and OpenOffCanvasDialogCommand.
BackwardsCompatibilityClassLoaderTest::testDoctrineException in core/tests/Drupal/KernelTests/Core/ClassLoader/BackwardsCompatibilityClassLoaderTest.php
Tests that the BC layer for Doctrine's AnnotationException works.
BackwardsCompatibilityClassLoaderTest::testModuleMovedClass in core/tests/Drupal/KernelTests/Core/ClassLoader/BackwardsCompatibilityClassLoaderTest.php
Tests that a moved class from a module works.
BcEngineTest::testPage in core/modules/system/tests/src/Functional/Theme/BcEngineTest.php
Tests that .engine theme engines still work.
BlockContentEntityReferenceSelectionTest::testNoConditions in core/modules/block_content/tests/src/Kernel/BlockContentEntityReferenceSelectionTest.php
Tests with no conditions set.

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