function ExpectDeprecationTrait::expectDeprecation

Adds an expected deprecation.

Parameters

string $message: The expected deprecation message.

121 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 82

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 {
  if (!DeprecationHandler::isDeprecationTest($this)) {
    throw new \RuntimeException('expectDeprecation() can only be called from tests marked with #[IgnoreDeprecations] or \'@group legacy\'');
  }
  if (!DeprecationHandler::isEnabled()) {
    return;
  }
  DeprecationHandler::expectDeprecation($message);
}

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