function StatusCheckTrait::runStatusCheck
Runs a status check for a stage and returns the results, if any.
Parameters
\Drupal\package_manager\StageBase $stage: The stage to run the status check for.
\Symfony\Contracts\EventDispatcher\EventDispatcherInterface|null $event_dispatcher: (optional) The event dispatcher service.
\Drupal\package_manager\PathLocator|null $path_locator: (optional) The path locator service.
\PhpTuf\ComposerStager\API\Path\Factory\PathFactoryInterface|null $path_factory: (optional) The path factory service.
Return value
\Drupal\package_manager\ValidationResult[] The results of the status check. If a readiness check was also done, its results will be included.
3 calls to StatusCheckTrait::runStatusCheck()
- PackageManagerKernelTestBase::assertStatusCheckResults in core/
modules/ package_manager/ tests/ src/ Kernel/ PackageManagerKernelTestBase.php - Asserts validation results are returned from the status check event.
- StatusCheckTraitTest::testPathsToExcludeCollected in core/
modules/ package_manager/ tests/ src/ Kernel/ StatusCheckTraitTest.php - Tests that StatusCheckTrait will collect paths to exclude.
- UnknownPathExcluderTest::testUnknownPath in core/
modules/ package_manager/ tests/ src/ Kernel/ PathExcluder/ UnknownPathExcluderTest.php - Tests that the unknown files and directories are excluded.
File
-
core/
modules/ package_manager/ src/ StatusCheckTrait.php, line 38
Class
- StatusCheckTrait
- Contains helper methods to run status checks on a stage.
Namespace
Drupal\package_managerCode
protected function runStatusCheck(StageBase $stage, ?EventDispatcherInterface $event_dispatcher = NULL, ?PathLocator $path_locator = NULL, ?PathFactoryInterface $path_factory = NULL) : array {
$event_dispatcher ??= \Drupal::service('event_dispatcher');
$path_locator ??= \Drupal::service(PathLocator::class);
$path_factory ??= \Drupal::service(PathFactoryInterface::class);
try {
$paths_to_exclude_event = new CollectPathsToExcludeEvent($stage, $path_locator, $path_factory);
$event_dispatcher->dispatch($paths_to_exclude_event);
} catch (\Throwable $throwable) {
$paths_to_exclude_event = $throwable;
}
$event = new StatusCheckEvent($stage, $paths_to_exclude_event);
return $event_dispatcher->dispatch($event)
->getResults();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.