function EnvironmentSupportValidatorTest::testInvalidUrl

Tests handling of an invalid URL in the environment support variable.

File

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

Class

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

Namespace

Drupal\Tests\package_manager\Kernel

Code

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

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