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

Values from data provider are not shown for failed test #5616

Closed
mvorisek opened this issue Dec 15, 2023 · 1 comment
Closed

Values from data provider are not shown for failed test #5616

mvorisek opened this issue Dec 15, 2023 · 1 comment
Assignees
Labels
feature/data-provider Data Providers feature/test-runner CLI test runner type/bug Something is broken version/10 Something affects PHPUnit 10

Comments

@mvorisek
Copy link
Contributor

Q A
PHPUnit version 10.5.3
PHP version any
Installation Method Composer

Summary

PHPUnit 10.x does currently shows only the data set # /wo dumping the data set values in the test header/output.

Currently, the developer has to go to the test code to even get a rough idea what the failed test is really about.

With a complex providers, it is even hard to tell by looking into the code what values were passed by a given data set # - example: https://github.com/atk4/ui/blob/5.0.0/tests/DemosTest.php#L305 - it is basically impossible.

I am reporting this as a bug, as PHPUnit 9.x output has/had the data set values dumped.

Current behavior

...
There were 2 failures:

1) Atk4\Ui\Tests\DemosHttpTest::testDemoJsonResponse with data set #3
Failed asserting that '{\n
,,,

How to reproduce

Any test with data provider.

Expected behavior

expected/PHPUnit 9.x output:

...
There were 2 failures:

1) Atk4\Ui\Tests\DemosHttpTest::testDemoJsonResponse with data set #3 ('_unit-test/exception.php?__at...json=1')
Failed asserting that '{\n
@mvorisek mvorisek added type/bug Something is broken version/10 Something affects PHPUnit 10 labels Dec 15, 2023
@sebastianbergmann sebastianbergmann changed the title PHPUnit 10.x does not dump data set values in test header Values from data provider are not shown for failed test Dec 16, 2023
@sebastianbergmann
Copy link
Owner

Test.php

<?php declare(strict_types=1);
use PHPUnit\Framework\TestCase;

final class Test extends TestCase
{
    public static function provider(): array
    {
        return [
            [1, '2', 3.0, true],
        ];
    }

    /**
     * @dataProvider provider
     */
    public function testOne(int $a, string $b, float $c, bool $d): void
    {
        $this->assertTrue(false);
    }
}

PHPUnit 10

1) Test::testOne with data set #0
Failed asserting that false is true.

PHPUnit 9

1) Test::testOne with data set #0 (1, '2', 3.0, true)
Failed asserting that false is true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/data-provider Data Providers feature/test-runner CLI test runner type/bug Something is broken version/10 Something affects PHPUnit 10
Projects
None yet
Development

No branches or pull requests

2 participants