function EnvironmentSupportValidatorTest::testInvalidUrlDuringPreApply

Tests an invalid URL in the environment support variable during pre-apply.

File

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

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testInvalidUrlDuringPreApply() : void {
    $this->addEventTestListener(function () : void {
        putenv(EnvironmentSupportValidator::VARIABLE_NAME . '=broken/url.org');
    });
    $result = ValidationResult::createError([
        t('Package Manager is not supported by your environment.'),
    ]);
    $this->assertEventPropagationStopped(PreApplyEvent::class, [
        $this->container
            ->get(EnvironmentSupportValidator::class),
        'validate',
    ]);
    $this->assertResults([
        $result,
    ], PreApplyEvent::class);
}

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