File tree Expand file tree Collapse file tree 6 files changed +5
-32
lines changed Expand file tree Collapse file tree 6 files changed +5
-32
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,6 @@ public function serialize($data): string;
2222 */
2323 public function extension (): string ;
2424
25- /**
26- * Load the contents of a snapshot at a path.
27- *
28- * @param string $path
29- *
30- * @return mixed
31- */
32- public function load (string $ path );
33-
3425 /**
3526 * Match an expectation with a snapshot's actual contents. Should throw an
3627 * `ExpectationFailedException` if it doesn't match. This happens by
Original file line number Diff line number Diff line change @@ -23,11 +23,6 @@ public function extension(): string
2323 return '.json ' ;
2424 }
2525
26- public function load (string $ path )
27- {
28- return file_get_contents ($ path );
29- }
30-
3126 public function match ($ expected , $ actual )
3227 {
3328 Assert::assertJson ($ expected );
Original file line number Diff line number Diff line change @@ -17,13 +17,10 @@ public function extension(): string
1717 return '.php ' ;
1818 }
1919
20- public function load (string $ path )
21- {
22- return include $ path ;
23- }
24-
2520 public function match ($ expected , $ actual )
2621 {
27- Assert::assertEquals ($ expected , $ actual );
22+ $ evaluated = eval (substr ($ expected , strlen ('<?php ' )));
23+
24+ Assert::assertEquals ($ evaluated , $ actual );
2825 }
2926}
Original file line number Diff line number Diff line change @@ -30,11 +30,6 @@ public function extension(): string
3030 return '.xml ' ;
3131 }
3232
33- public function load (string $ path )
34- {
35- return file_get_contents ($ path );
36- }
37-
3833 public function match ($ expected , $ actual )
3934 {
4035 Assert::assertEquals (Xml::load ($ expected ), Xml::load ($ actual ));
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ public function has(string $filename): bool
2727 return file_exists ($ this ->path ($ filename ));
2828 }
2929
30- public function read (string $ filename ): bool
30+ public function read (string $ filename ): string
3131 {
3232 return file_get_contents ($ this ->path ($ filename ));
3333 }
Original file line number Diff line number Diff line change @@ -43,19 +43,14 @@ public function filename(): string
4343 return $ this ->id .$ this ->driver ->extension ();
4444 }
4545
46- public function path (): string
47- {
48- return $ this ->filesystem ->path ($ this ->filename ());
49- }
50-
5146 public function exists (): bool
5247 {
5348 return $ this ->filesystem ->has ($ this ->filename ());
5449 }
5550
5651 public function assertMatches ($ actual )
5752 {
58- $ this ->driver ->match ($ this ->driver -> load ($ this ->path ()), $ actual );
53+ $ this ->driver ->match ($ this ->filesystem -> read ($ this ->filename ()), $ actual );
5954 }
6055
6156 public function create ($ actual )
You can’t perform that action at this time.
0 commit comments