diff --git a/.github/workflows/tests-levels-matrix.php b/.github/workflows/tests-levels-matrix.php new file mode 100644 index 0000000000..ecdb0cb964 --- /dev/null +++ b/.github/workflows/tests-levels-matrix.php @@ -0,0 +1,32 @@ +testCaseClass as $testCaseClass) { + foreach($testCaseClass->testCaseMethod as $testCaseMethod) { + if ((string) $testCaseMethod['groups'] !== 'levels') { + continue; + } + + $testCaseName = (string) $testCaseMethod['id']; + + [$className, $testName] = explode('::', $testCaseName, 2); + $fileName = 'tests/'. str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php'; + + $filter = str_replace('\\', '\\\\', $testCaseName); + + $testFilters[] = sprintf("%s --filter %s", escapeshellarg($fileName), escapeshellarg($filter)); + } +} + +if ($testFilters === []) { + throw new RuntimeException('No tests found'); +} + +echo json_encode($testFilters); diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 805771f017..dc59d0f243 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -98,11 +98,45 @@ jobs: - name: "Tests" run: "make tests-integration" + tests-levels-matrix: + name: "Determine levels tests matrix" + runs-on: ubuntu-latest + timeout-minutes: 60 + + steps: + - name: "Checkout" + uses: actions/checkout@v3 + + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + coverage: "none" + php-version: "8.3" + tools: pecl + extensions: ds,mbstring + ini-file: development + ini-values: memory_limit=1G + + - name: "Install PHPUnit 10.x" + run: "composer remove --dev brianium/paratest && composer require --dev --with-all-dependencies phpunit/phpunit:^10" + + - id: set-matrix + run: echo "matrix=$(php .github/workflows/tests-levels-matrix.php)" >> $GITHUB_OUTPUT + + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + tests-levels: + needs: tests-levels-matrix + name: "Levels tests" runs-on: ubuntu-latest timeout-minutes: 60 + strategy: + matrix: + test-filter: "${{fromJson(needs.tests-levels-matrix.outputs.matrix)}}" + steps: - name: "Checkout" uses: actions/checkout@v3 @@ -121,7 +155,7 @@ jobs: run: "composer install --no-interaction --no-progress" - name: "Tests" - run: "make tests-levels" + run: "php vendor/bin/phpunit ${{ matrix.test-filter }} --group levels" tests-old-phpunit: name: "Tests with old PHPUnit" diff --git a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php index ff9068d835..3d123ccfe2 100644 --- a/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php +++ b/src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php @@ -112,6 +112,7 @@ public function create(string $projectInstallationPath): ?SourceLocator foreach ($classMapPaths as $classMapPath) { if (is_dir($classMapPath)) { $locators[] = $this->optimizedDirectorySourceLocatorRepository->getOrCreate($classMapPath); + continue; } if (!is_file($classMapPath)) { continue;