function PackageManagerKernelTestBase::assertResults
Asserts validation results are returned from a stage life cycle event.
Parameters
\Drupal\package_manager\ValidationResult[] $expected_results: The expected validation results.
string|null $event_class: (optional) The class of the event which should return the results. Must be passed if $expected_results is not empty.
Return value
\Drupal\package_manager\StageBase The stage that was used to collect the validation results.
46 calls to PackageManagerKernelTestBase::assertResults()
- AllowedScaffoldPackagesValidatorTest::testPreApply in core/
modules/ package_manager/ tests/ src/ Kernel/ AllowedScaffoldPackagesValidatorTest.php - Tests that the allowed-packages setting is validated during pre-apply.
- AllowedScaffoldPackagesValidatorTest::testPreCreate in core/
modules/ package_manager/ tests/ src/ Kernel/ AllowedScaffoldPackagesValidatorTest.php - Tests that the allowed-packages setting is validated during pre-create.
- BaseRequirementsFulfilledValidatorTest::testBaseRequirement in core/
modules/ package_manager/ tests/ src/ Kernel/ BaseRequirementsFulfilledValidatorTest.php - Tests that base requirement failures stop event propagation.
- ComposerPatchesValidatorTest::testErrorDuringPreCreate in core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerPatchesValidatorTest.php - Tests that the patcher configuration is validated during pre-create.
- ComposerPluginsValidatorTest::testInsecureConfigurationFailsValidationPreApply in core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerPluginsValidatorTest.php - Tests `config.allow-plugins: true` fails validation during pre-apply.
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ PackageManagerKernelTestBase.php, line 206
Class
- PackageManagerKernelTestBase
- Base class for kernel tests of Package Manager's functionality.
Namespace
Drupal\Tests\package_manager\KernelCode
protected function assertResults(array $expected_results, ?string $event_class = NULL) : StageBase {
$stage = $this->createStage();
try {
$stage->create();
$stage->require([
'drupal/core:9.8.1',
]);
$stage->apply();
$stage->postApply();
$stage->destroy();
// If we did not get an exception, ensure we didn't expect any results.
$this->assertValidationResultsEqual([], $expected_results);
} catch (StageEventException $e) {
$this->assertNotEmpty($expected_results);
$this->assertInstanceOf($event_class, $e->event);
$this->assertExpectedResultsFromException($expected_results, $e);
}
return $stage;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.