Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php artisan test --profile not printing results (profileSlowTests in DefaultPrinter) #309

Open
stephenstack opened this issue Jul 24, 2024 · 1 comment

Comments

@stephenstack
Copy link

I have never been able to get php artisan test --profile working. I dug deep today and i ended up in vendor/nunomaduro/collision/src/Adapters/Phpunit/Printers/DefaultPrinter.php

on line 422, when I move
$this->style->writeSlowTests($this->profileSlowTests, $event->telemetryInfo());
outside the IF block, I get profile results as expected.

Seems to me, that $failed = !Facade::result()->wasSuccessful(); does return TRUE on line 414 as expected
BUT
The IF on line 421 negates the $failed to evaluate the true as false, thus failing the check, thus the profile results are not printed. See full block below.

If this is the issue, i'll PR it, or am i missing something obvious?

    if (class_exists(Result::class)) {
        $failed = Result::failed(Registry::get(), Facade::result());
    } else {
        $failed = !Facade::result()->wasSuccessful();
     }

    $this->style->writeErrorsSummary($this->state);

    $this->style->writeRecap($this->state, $event->telemetryInfo(), $result);

    if (!$failed && count($this->profileSlowTests) > 0) {
        $this->style->writeSlowTests($this->profileSlowTests, $event->telemetryInfo());
    }
@stephenstack
Copy link
Author

@nunomaduro lots of open issues and PRs here. I'm happy to open a PR for the above issue, but are you able to review? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant