nunomaduro/collision

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

Opened this issue · 1 comments

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());
    }

@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? 🙏