function RunTimeRequirementsTest::testRuntimeRequirements
Tests hook_runtime_requirements() and hook_runtime_requirements_alter().
File
-
core/
modules/ system/ tests/ src/ Kernel/ System/ RunTimeRequirementsTest.php, line 27
Class
- RunTimeRequirementsTest
- Tests the effectiveness of hook_runtime_requirements().
Namespace
Drupal\Tests\system\Kernel\SystemCode
public function testRuntimeRequirements() : void {
// Enable the test module.
\Drupal::service('module_installer')->install([
'module_runtime_requirements',
]);
$testRequirements = [
'title' => 'RuntimeError',
'value' => 'None',
'description' => 'Runtime Error.',
'severity' => REQUIREMENT_ERROR,
];
$requirements = \Drupal::service('system.manager')->listRequirements()['test.runtime.error'];
$this->assertEquals($testRequirements, $requirements);
$testRequirementsAlter = [
'title' => 'RuntimeWarning',
'value' => 'None',
'description' => 'Runtime Warning.',
'severity' => REQUIREMENT_WARNING,
];
$requirementsAlter = \Drupal::service('system.manager')->listRequirements()['test.runtime.error.alter'];
$this->assertEquals($testRequirementsAlter, $requirementsAlter);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.