function EnvironmentSupportValidatorTest::testValidUrlDuringPreApply

Tests that the validation message links to the provided URL during pre-apply.

File

core/modules/package_manager/tests/src/Kernel/EnvironmentSupportValidatorTest.php, line 69

Class

EnvironmentSupportValidatorTest
@covers \Drupal\package_manager\Validator\EnvironmentSupportValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testValidUrlDuringPreApply() : void {
    $url = 'http://www.example.com';
    $this->addEventTestListener(function () use ($url) : void {
        putenv(EnvironmentSupportValidator::VARIABLE_NAME . '=' . $url);
    });
    $result = ValidationResult::createError([
        t('<a href=":url">Package Manager is not supported by your environment.</a>', [
            ':url' => $url,
        ]),
    ]);
    $this->assertResults([
        $result,
    ], PreApplyEvent::class);
}

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