spatie/phpunit-snapshot-assertions

FileSnapShot no longer includes the name of the data provider

benfreke opened this issue · 0 comments

This is a breaking change from v4, and I'll add an example later when I get a chance.

But in v4, with PhpUnit v9, the dataProvider name was used in the file snapshot.

In v5 with PhpUnit v10, it is not.

    public static function dataTestRun(): array
    {
        return [
            'no database' => [
                null,
            ],
            'mysql database' => [
                new Mysql(),
            ],
            'pgsql database' => [
                new Pgsql(),
            ],
        ];
    }

This used to result in 3 files being created for Php80Test::testRun of

Php80Test__testRun with data set mysql database__1.txt
Php80Test__testRun with data set no database__1.txt
Php80Test__testRun with data set pgsql database__1.txt

Now I only get 1 file, Php80Test__testRun__1.txt, which is missing the detail in the filename needed from the data provider to distinguish between 3 runs of the method for different values in the data provider.

I've had a quick look through the code and can't see anything obvious. I suspect the changes to PhpUnit 10 events is the culprit, but I'll add some test cases when I can and attempt to create a PR. I just wanted to make sure this was logged.