Skip to content

Commit 466fb25

Browse files
committed
Allow to pass on string
1 parent 21a26cd commit 466fb25

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/MatchesSnapshots.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ trait MatchesSnapshots
1111
use BaseMatchesSnapshots;
1212

1313
/**
14-
* Asserts the structure of the response json with a snapshot.
14+
* Asserts the structure of the json structure with a snapshot.
1515
*
16-
* @param \Illuminate\Foundation\Testing\TestResponse $response
16+
* @param mixed $actual
1717
* @return void
1818
*/
19-
public function assertJsonStructureSnapshot(TestResponse $response): void
19+
public function assertJsonStructureSnapshot($actual): void
2020
{
21-
$this->assertMatchesSnapshot(
22-
$response->json(),
23-
new JsonStructureDriver()
24-
);
21+
$json = $actual instanceof TestResponse
22+
? $actual->json()
23+
: $actual;
24+
25+
$this->assertMatchesSnapshot($json, new JsonStructureDriver());
2526
}
2627
}

0 commit comments

Comments
 (0)