Skip to content

Commit 321075d

Browse files
committed
fix: ensure make:test works on Windows
1 parent 3bef730 commit 321075d

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

system/Commands/Generators/TestGenerator.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -173,20 +173,17 @@ protected function buildPath(string $class): string
173173
/**
174174
* Returns test file path for the namespace.
175175
*/
176-
private function searchTestFilePath(string $namespace): ?string
176+
private function searchTestFilePath(string $testNamespace): ?string
177177
{
178-
$bases = service('autoloader')->getNamespace($namespace);
178+
/** @var list<non-empty-string> $testPaths */
179+
$testPaths = service('autoloader')->getNamespace($testNamespace);
179180

180-
$base = null;
181-
182-
foreach ($bases as $candidate) {
183-
if (str_contains($candidate, '/tests/')) {
184-
$base = $candidate;
185-
186-
break;
181+
foreach ($testPaths as $candidate) {
182+
if (str_contains($candidate, DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)) {
183+
return $candidate;
187184
}
188185
}
189186

190-
return $base;
187+
return null;
191188
}
192189
}

0 commit comments

Comments
 (0)