diff --git a/src/Concerns/SnapshotIdAware.php b/src/Concerns/SnapshotIdAware.php index 34f40c6..ee9bcb6 100644 --- a/src/Concerns/SnapshotIdAware.php +++ b/src/Concerns/SnapshotIdAware.php @@ -6,14 +6,25 @@ trait SnapshotIdAware { + private ?string $snapshotId = null; + /* * Determines the snapshot's id. By default, the test case's class and * method names are used. */ protected function getSnapshotId(): string { + if ($this->snapshotId !== null) { + return $this->snapshotId; + } + return (new ReflectionClass($this))->getShortName().'__'. $this->nameWithDataSet().'__'. $this->snapshotIncrementor; } + + protected function setSnapshotId(string $snapshotId): void + { + $this->snapshotId = $snapshotId; + } }