From f982c7a2864fb88c6e7c919ca316da9f96bf08b8 Mon Sep 17 00:00:00 2001
From: odrais-amsicorp <110840860+odrais-amsicorp@users.noreply.github.com>
Date: Fri, 11 Apr 2025 12:28:37 -0500
Subject: [PATCH] Support multiple test paths
To import tests from multiple paths, list the paths separated by a space:
`php list-tests path1 [path2] [path3]...`
---
src/Command.php | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/Command.php b/src/Command.php
index 4b90cec..ea34a3b 100644
--- a/src/Command.php
+++ b/src/Command.php
@@ -13,7 +13,7 @@ class Command extends SymfonyCommand
protected function configure()
{
- $this->addArgument('path', InputArgument::REQUIRED, 'Path to scan for tests');
+ $this->addArgument('path', InputArgument::REQUIRED | InputArgument::IS_ARRAY, 'Path(s) to scan for tests');
$this->addOption('markdown', 'm',InputOption::VALUE_REQUIRED, 'Save data information to markdown file');
}
@@ -21,13 +21,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
{
// ... put here the code to run in your command
- $output->writeln("Printing tests from " . $input->getArgument('path') . '');
+ $output->writeln("Printing tests from " . implode(', ', $input->getArgument('path')) . '');
$output->writeln('This may take some time on large projects...');
$output->writeln('');
$checkTests = new CheckTests($output);
- $checkTests->analyze($input->getArgument('path'));
- $tests = $checkTests->getTests();
+ $paths = $input->getArgument('path');
+ $tests = [];
+ foreach ($paths as $path) {
+ $checkTests->analyze($path);
+ $tests = array_merge($tests, $checkTests->getTests());
+ }
$numTests = count($tests);
$printer = new Printer($tests);