chore: fixes test:unit

This commit is contained in:
nuno maduro
2026-04-10 12:15:00 +01:00
parent 8a83a1a1a9
commit e766825f5b
8 changed files with 19 additions and 17 deletions

View File

@ -56,7 +56,7 @@
},
"require-dev": {
"pestphp/pest-dev-tools": "^4.1.0",
"pestphp/pest-plugin-browser": "^4.3.0",
"pestphp/pest-plugin-browser": "^4.3.1",
"pestphp/pest-plugin-type-coverage": "^4.0.4",
"psy/psysh": "^0.12.22"
},

View File

@ -684,23 +684,19 @@ final class Expectation
$realPath = realpath($object->path);
foreach (Composer::userNamespaces() as $directory => $namespace) {
foreach (Composer::userNamespacesWithDirectories() as $directory => $namespace) {
if (str_starts_with($realPath, $directory)) {
$relativePath = substr($realPath, strlen($directory) + 1);
$relativePath = explode('.', $relativePath)[0];
$classFromPath = $namespace.'\\'.str_replace(DIRECTORY_SEPARATOR, '\\', $relativePath);
if ($classFromPath === $object->reflectionClass->getName()) {
return true;
}
return false;
return $classFromPath === $object->reflectionClass->getName();
}
}
return false;
},
"to be cased correctly",
'to be cased correctly',
FileLineFinder::where(fn (string $line): bool => str_contains($line, 'class')),
);
}

View File

@ -448,6 +448,10 @@
✓ failures with custom message
✓ not failures
PASS Tests\Features\Expect\toBeCasedCorrectly
✓ pass
✓ failure
PASS Tests\Features\Expect\toBeDigits
✓ pass
✓ failures
@ -1034,6 +1038,10 @@
✓ pass
✓ failures
✓ not failures
✓ trait inheritance - direct usage
✓ trait inheritance - inherited usage
✓ trait inheritance - negative case
✓ nested trait inheritance
PASS Tests\Features\Expect\unless
✓ it pass
@ -1801,4 +1809,4 @@
✓ pass with dataset with ('my-datas-set-value')
✓ within describe → pass with dataset with ('my-datas-set-value')
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1203 passed (2835 assertions)
Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 39 todos, 35 skipped, 1209 passed (2842 assertions)

View File

@ -6,6 +6,4 @@ namespace Tests\Fixtures\Arch\ToUseTrait\HasInheritedTrait;
use Tests\Fixtures\Arch\ToUseTrait\HasTrait\ParentClassWithTrait;
class ChildClassExtendingParent extends ParentClassWithTrait
{
}
class ChildClassExtendingParent extends ParentClassWithTrait {}

View File

@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) {
expect($run('--exclude-group=integration'))
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 3 notices, 39 todos, 26 skipped, 1190 passed (2802 assertions)')
->toContain('Tests: 2 deprecated, 4 warnings, 5 incomplete, 3 notices, 39 todos, 26 skipped, 1196 passed (2809 assertions)')
->toContain('Parallel: 3 processes');
})->skipOnWindows();