Skip to content

Commit f11add3

Browse files
authored
Merge branch refs/heads/1.10.x into 1.11.x
2 parents 1f47c53 + 938321c commit f11add3

File tree

3 files changed

+68
-1
lines changed

3 files changed

+68
-1
lines changed
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php declare(strict_types = 1);
2+
3+
shell_exec('php vendor/bin/phpunit --list-tests-xml test-list.xml');
4+
5+
$simpleXml = simplexml_load_file('test-list.xml');
6+
if ($simpleXml === false) {
7+
throw new RuntimeException('Error loading test-list.xml');
8+
}
9+
10+
$testFilters = [];
11+
foreach($simpleXml->testCaseClass as $testCaseClass) {
12+
foreach($testCaseClass->testCaseMethod as $testCaseMethod) {
13+
if ((string) $testCaseMethod['groups'] !== 'levels') {
14+
continue;
15+
}
16+
17+
$testCaseName = (string) $testCaseMethod['id'];
18+
19+
[$className, $testName] = explode('::', $testCaseName, 2);
20+
$fileName = 'tests/'. str_replace('\\', DIRECTORY_SEPARATOR, $className) . '.php';
21+
22+
$filter = str_replace('\\', '\\\\', $testCaseName);
23+
24+
$testFilters[] = sprintf("%s --filter %s", escapeshellarg($fileName), escapeshellarg($filter));
25+
}
26+
}
27+
28+
if ($testFilters === []) {
29+
throw new RuntimeException('No tests found');
30+
}
31+
32+
echo json_encode($testFilters);

.github/workflows/tests.yml

+35-1
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,45 @@ jobs:
9898
- name: "Tests"
9999
run: "make tests-integration"
100100

101+
tests-levels-matrix:
102+
name: "Determine levels tests matrix"
103+
runs-on: ubuntu-latest
104+
timeout-minutes: 60
105+
106+
steps:
107+
- name: "Checkout"
108+
uses: actions/checkout@v3
109+
110+
- name: "Install PHP"
111+
uses: "shivammathur/setup-php@v2"
112+
with:
113+
coverage: "none"
114+
php-version: "8.3"
115+
tools: pecl
116+
extensions: ds,mbstring
117+
ini-file: development
118+
ini-values: memory_limit=1G
119+
120+
- name: "Install PHPUnit 10.x"
121+
run: "composer remove --dev brianium/paratest && composer require --dev --with-all-dependencies phpunit/phpunit:^10"
122+
123+
- id: set-matrix
124+
run: echo "matrix=$(php .github/workflows/tests-levels-matrix.php)" >> $GITHUB_OUTPUT
125+
126+
outputs:
127+
matrix: ${{ steps.set-matrix.outputs.matrix }}
128+
101129
tests-levels:
130+
needs: tests-levels-matrix
131+
102132
name: "Levels tests"
103133
runs-on: ubuntu-latest
104134
timeout-minutes: 60
105135

136+
strategy:
137+
matrix:
138+
test-filter: "${{fromJson(needs.tests-levels-matrix.outputs.matrix)}}"
139+
106140
steps:
107141
- name: "Checkout"
108142
uses: actions/checkout@v4
@@ -121,7 +155,7 @@ jobs:
121155
run: "composer install --no-interaction --no-progress"
122156

123157
- name: "Tests"
124-
run: "make tests-levels"
158+
run: "php vendor/bin/phpunit ${{ matrix.test-filter }} --group levels"
125159

126160
tests-old-phpunit:
127161
name: "Tests with old PHPUnit"

src/Reflection/BetterReflection/SourceLocator/ComposerJsonAndInstalledJsonSourceLocatorMaker.php

+1
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public function create(string $projectInstallationPath): ?SourceLocator
112112
foreach ($classMapPaths as $classMapPath) {
113113
if (is_dir($classMapPath)) {
114114
$locators[] = $this->optimizedDirectorySourceLocatorRepository->getOrCreate($classMapPath);
115+
continue;
115116
}
116117
if (!is_file($classMapPath)) {
117118
continue;

0 commit comments

Comments
 (0)