function DrupalTestCaseTrait::expectExceptionMessageIsOrContains

Same name and namespace in other branches
  1. main core/tests/Drupal/Tests/DrupalTestCaseTrait.php \Drupal\Tests\DrupalTestCaseTrait::expectExceptionMessageIsOrContains()

Expects an exception message containing a specified string.

Forward compatibility for PHPUnit 13.

Parameters

string $message: The expected exception message.

31 calls to DrupalTestCaseTrait::expectExceptionMessageIsOrContains()
AddModerationConfigActionTest::testActionOnlyTargetsWorkflows in core/modules/content_moderation/tests/src/Kernel/ConfigAction/AddModerationConfigActionTest.php
Tests that the action only targets workflows.
AddToAllBundlesConfigActionTest::testInstantiateNewFieldOnAllBundles in core/modules/field/tests/src/Kernel/AddToAllBundlesConfigActionTest.php
Tests instantiating a field on all bundles of an entity type.
AllowedValuesConstraintValidatorTest::testValidationCallbackException in core/tests/Drupal/KernelTests/Core/TypedData/AllowedValuesConstraintValidatorTest.php
Tests the AllowedValuesConstraintValidator with an invalid callback.
BrowserTestBaseTest::testError in core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php
ComposerInspectorTest::testConfig in core/modules/package_manager/tests/src/Kernel/ComposerInspectorTest.php
Tests config.

... See full list

File

core/tests/Drupal/Tests/DrupalTestCaseTrait.php, line 131

Class

DrupalTestCaseTrait
Provides methods common across all Drupal abstract base test classes.

Namespace

Drupal\Tests

Code

protected function expectExceptionMessageIsOrContains(string $message) : void {
  $this->expectExceptionMessage($message);
}

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