Problem/Motivation
The search_api_db_defaults_requirements() function in the search_api_db_defaults module uses the deprecated REQUIREMENT_ERROR constant:
'requirements' => [
'severity' => REQUIREMENT_ERROR,
]
As of Drupal 11.2.0, this constant is deprecated and will be removed in Drupal 12.0.0:
REQUIREMENT_ERROR is deprecated in drupal:11.2.0 and removed in drupal:12.0.0. Use \Drupal\Core\Extension\Requirement\RequirementSeverity::Error instead.
When running the functional test \Drupal\Tests\search_api_db_defaults\Functional\IntegrationTest::testInstallAndDefaultSetupWorking,
the test fails because the severity level is not correctly interpreted in newer Drupal versions โ no error message is printed as expected.
This is due to the conditional check using:
if ($requirement['severity'] === RequirementSeverity::Error)
โฆwhich will not match REQUIREMENT_ERROR (int 2 vs. \RequirementSeverity::Error enum), leading to a silent failure.
Steps to reproduce
Run the test:
--filter=testInstallAndDefaultSetupWorking
Proposed resolution
Update the severity key to use the enum class:
use Drupal\Core\Extension\Requirement\RequirementSeverity;
...
'requirements' => [
'severity' => RequirementSeverity::Error,
]
This ensures forward compatibility and fixes the test behavior under Drupal 11+.
Remaining tasks