Skip to content

Commit d457616

Browse files
committed
fix: Create correct snapshot file names in repetitions
1 parent 2bfc9b6 commit d457616

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

phpstan.neon.dist

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ parameters:
1616
#- '#Method .* has a nullable return type declaration#'
1717
#- '#Method .* has parameter .* with a nullable type declaration#'
1818
- '#Method .* has parameter .* with null as default value#'
19-
- '#Method Brainbits\\FunctionalTestHelpers\\Tests\\Snapshot\\.*SnapshotTest::assertMatches.*Snapshot\(\) is protected, but since the containing class is final, it can be private.#'
19+
- '#Method Brainbits\\FunctionalTestHelpers\\Tests\\.*Test::assertMatches.*Snapshot\(\) is protected, but since the containing class is final, it can be private.#'
20+
- '#Method Brainbits\\FunctionalTestHelpers\\Tests\\.*Test::setUpSnapshot\(\) is protected, but since the containing class is final, it can be private.#'
2021
- '#Method Brainbits\\FunctionalTestHelpers\\Tests\\ZipContents\\ZipContentsTraitTest::.* is protected, but since the containing class is final, it can be private#'
2122
ergebnis:
2223
classesAllowedToBeExtended:

src/Snapshot/SnapshotTrait.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
trait SnapshotTrait
3838
{
3939
/** @var array<string,int> */
40-
private array $filenames = [];
40+
private array $filenames;
41+
42+
/** @before */
43+
final protected function setUpSnapshot(): void
44+
{
45+
$this->filenames = [];
46+
}
4147

4248
/** @param mixed[] $actual */
4349
final protected function assertMatchesArraySnapshot(array $actual, string $message = ''): void

0 commit comments

Comments
 (0)