Skip to content
Snippets Groups Projects
Commit fcd14fd4 authored by Adam G-H's avatar Adam G-H
Browse files

Issue #3345768 by phenaproxima: StatusCheckTraitTest should use...

Issue #3345768 by phenaproxima: StatusCheckTraitTest should use ComposerInspector instead of ComposerUtility
parent 2137e29e
No related branches found
No related tags found
No related merge requests found
......@@ -39,21 +39,18 @@ class StatusCheckTraitTest extends PackageManagerKernelTestBase {
* Tests StatusCheckTrait returns an error when unable to get ignored paths.
*/
public function testErrorIgnoredPathsCollected(): void {
$composer_json_path = $this->container->get('package_manager.path_locator')->getProjectRoot() . '/composer.json';
// Delete composer.json, so we won't be able to get excluded paths.
unlink($composer_json_path);
$this->addEventTestListener(function (CollectIgnoredPathsEvent $event): void {
// Try to get composer.
$event->stage->getActiveComposer();
$exception = new \Exception("Not a chance, friend.");
$expected_result = ValidationResult::createErrorFromThrowable(
$exception,
t("Unable to collect ignored paths, therefore can't perform status checks.")
);
$this->addEventTestListener(function () use ($exception): void {
throw $exception;
}, CollectIgnoredPathsEvent::class);
$results = $this->runStatusCheck($this->createStage(), $this->container->get('event_dispatcher'));
$expected_results = [
ValidationResult::createErrorFromThrowable(
new \Exception("Composer could not find the config file: $composer_json_path\n"),
t("Unable to collect ignored paths, therefore can't perform status checks."),
),
];
$this->assertValidationResultsEqual($expected_results, $results);
$this->assertStatusCheckResults([$expected_result]);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment