mikeerickson / phpunit-pretty-result-printer

PHPUnit Pretty Result Printer -- make your PHPUnit tests look pretty!
MIT License
1.2k stars 71 forks source link

Weird Printing #165

Closed ian-patel closed 4 years ago

ian-patel commented 4 years ago

It's not pretty result after upgrade. Checkboxes are not inline.

PHPUnit Pretty Result Printer 0.28.0 PHPUnit 8.5.8 Laravel Framework 7.25.0 MacOS iTerm2 Font: Melso LG L DZ for Powerline

image

mikeerickson commented 4 years ago

Looks like you might have some var_dump in either the tests or working classes.

Easiest way to debug close would be to create a new simple test class with a few assertions

./vendor/bin/phpunit—filter NewTestClass
mikeerickson commented 4 years ago

If you still have troubles, try whipping together a new Laravel app and test again to try and remove any variables.

You can add some more assertions to the example tests that come out of the box and see what happens

ian-patel commented 4 years ago

I tried with new Test class, it worked fine. Not sure what's wrong with existing tests.

ian-patel commented 4 years ago

When I use Illuminate\Foundation\Testing\TestCase that time it print weird. It was working fine with v0.26.2. Recently I upgraded to v0.28.0.


namespace Tests\Unit;

use Tests\CreatesApplication;
use Illuminate\Foundation\Testing\TestCase; // here

class ExampleTest extends TestCase
{
    use CreatesApplication;

    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest()
    {
        $this->assertTrue(true);
    }

    /**
     * A basic test example.
     *
     * @return void
     */
    public function testBasicTest2()
    {
        $this->assertTrue(true);
    }
}

image

mikeerickson commented 4 years ago

What version of Laravel are you using? What version of PHP are you using?

When it worked as stated above, what TestCase were you using?

ian-patel commented 4 years ago

Laravel: v7.27.0 PHP: 7.4.9

It was working fine when ExampleTest was extending PHPUnit\Framework\TestCase

mikeerickson commented 4 years ago

I just created a new testing application and configured as you have defined and all is working as well.

Did you modify either Illuminate\Foundation\Testing\TestCase or CreateApplication trait? Did you modify any other support files?

I am posting my test application here should you want to try, but all seems good on this end

https://github.com/mikeerickson/laravel-printer-test

ian-patel commented 4 years ago

There was empty line before <?php in one file. That was causing this issue. Fixed.

mikeerickson commented 4 years ago

Well, I am glad you got things working!