function SupportedReleaseValidatorTest::testException

Tests exceptions when updating to unsupported or insecure releases.

@dataProvider providerException

Parameters

array $release_metadata: Array of paths of the fake release metadata keyed by project name.

bool $project_in_active: Whether the project is in the active directory or not.

array $package: The package that will be added or modified.

array $expected_results: The expected validation results.

File

core/modules/package_manager/tests/src/Kernel/SupportedReleaseValidatorTest.php, line 223

Class

SupportedReleaseValidatorTest
@coversDefaultClass \Drupal\package_manager\Validator\SupportedReleaseValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testException(array $release_metadata, bool $project_in_active, array $package, array $expected_results) : void {
    $this->setReleaseMetadata([
        'drupal' => __DIR__ . '/../../fixtures/release-history/drupal.9.8.2.xml',
    ] + $release_metadata);
    $stage_manipulator = $this->getStageFixtureManipulator();
    if ($project_in_active) {
        $stage_manipulator->setVersion($package['name'], $package['version']);
    }
    else {
        $stage_manipulator->addPackage($package);
    }
    // We always update this module to prove that the validator will skip this
    // module as it's of type 'drupal-library'.
    // @see \Drupal\package_manager\Validator\SupportedReleaseValidator::checkStagedReleases()
    $stage_manipulator->setVersion('drupal/dependency', '9.8.1');
    $this->assertResults($expected_results, PreApplyEvent::class);
    // Ensure that any errors arising from invalid project info (which we expect
    // in this test) will not fail the test during tear-down.
    $this->failureLogger
        ->reset();
}

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