Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions system/Commands/Generators/TestGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,20 +173,17 @@ protected function buildPath(string $class): string
/**
* Returns test file path for the namespace.
*/
private function searchTestFilePath(string $namespace): ?string
private function searchTestFilePath(string $testNamespace): ?string
{
$bases = service('autoloader')->getNamespace($namespace);
/** @var list<non-empty-string> $testPaths */
$testPaths = service('autoloader')->getNamespace($testNamespace);

$base = null;

foreach ($bases as $candidate) {
if (str_contains($candidate, '/tests/')) {
$base = $candidate;

break;
foreach ($testPaths as $candidate) {
if (str_contains($candidate, DIRECTORY_SEPARATOR . 'tests' . DIRECTORY_SEPARATOR)) {
return $candidate;
}
}

return $base;
return null;
}
}
1 change: 1 addition & 0 deletions user_guide_src/source/changelogs/v4.6.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Bugs Fixed
**********

- **Cache:** Fixed a bug where a corrupted or unreadable cache file could cause an unhandled exception in ``FileHandler::getItem()``.
- **Commands:** Fixed a bug in ``make:test`` where it would always error on Windows.
- **CURLRequest:** Fixed a bug where intermediate HTTP responses were not properly removed from the response chain in certain scenarios, causing incorrect status codes and headers to be returned instead of the final response.
- **Database:** Fixed a bug where ``when()`` and ``whenNot()`` in ``ConditionalTrait`` incorrectly evaluated certain falsy values (such as ``[]``, ``0``, ``0.0``, and ``'0'``) as truthy, causing callbacks to be executed unexpectedly. These methods now cast the condition to a boolean using ``(bool)`` to ensure consistent behavior with PHP's native truthiness.
- **Database:** Fixed encapsulation violation in ``BasePreparedQuery`` when accessing ``BaseConnection::transStatus`` protected property.
Expand Down
Loading