function RequirementsTest::testRequirementsAlter

Same name in other branches
  1. 9 core/modules/system/tests/src/Kernel/Module/RequirementsTest.php \Drupal\Tests\system\Kernel\Module\RequirementsTest::testRequirementsAlter()
  2. 11.x core/modules/system/tests/src/Kernel/Module/RequirementsTest.php \Drupal\Tests\system\Kernel\Module\RequirementsTest::testRequirementsAlter()

Tests requirements data altering.

File

core/modules/system/tests/src/Kernel/Module/RequirementsTest.php, line 26

Class

RequirementsTest
Covers hook_requirements and hook_requirements_alter. @group Module

Namespace

Drupal\Tests\system\Kernel\Module

Code

public function testRequirementsAlter() : void {
    $requirements = $this->container
        ->get('system.manager')
        ->listRequirements();
    // @see requirements1_test_requirements_alter()
    $this->assertEquals('Requirements 1 Test - Changed', $requirements['requirements1_test_alterable']['title']);
    $this->assertEquals(REQUIREMENT_WARNING, $requirements['requirements1_test_alterable']['severity']);
    $this->assertArrayNotHasKey('requirements1_test_deletable', $requirements);
}

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