@@ -10,24 +10,24 @@ public function assertMatchesSnapshot($serializable)
1010 {
1111 $ this ->snapshotCount ++;
1212
13- $ snapshot = Snapshot ::forTestMethod (
13+ $ snapshotHandler = SnapshotHandler ::forTestMethod (
1414 debug_backtrace (DEBUG_BACKTRACE_PROVIDE_OBJECT , 2 )[1 ],
1515 $ this ->snapshotCount
1616 );
1717
18- if (! $ snapshot ->exists ()) {
19- $ snapshot ->create ($ this ->serializeForSnapshot ($ serializable ));
18+ if (! $ snapshotHandler ->exists ()) {
19+ $ snapshotHandler ->create ($ this ->serializeForSnapshot ($ serializable ));
2020
21- return $ this ->markTestIncomplete ("Snapshot created for {$ snapshot ->id ()}" );
21+ return $ this ->markTestIncomplete ("Snapshot created for {$ snapshotHandler ->id ()}" );
2222 }
2323
24- if ($ this ->updateSnapshots ()) {
25- $ snapshot ->update ($ this ->serializeForSnapshot ($ serializable ));
24+ if ($ this ->shouldUpdateSnapshots ()) {
25+ $ snapshotHandler ->update ($ this ->serializeForSnapshot ($ serializable ));
2626
27- return $ this ->markTestIncomplete ("Snapshot updated for {$ snapshot ->id ()}" );
27+ return $ this ->markTestIncomplete ("Snapshot updated for {$ snapshotHandler ->id ()}" );
2828 }
2929
30- return $ this ->assertEquals ($ snapshot ->get (), $ serializable );
30+ return $ this ->assertEquals ($ snapshotHandler ->get (), $ serializable );
3131 }
3232
3333 /** @after **/
@@ -36,27 +36,9 @@ public function resetSnapshotCounter()
3636 $ this ->snapshotCount = 0 ;
3737 }
3838
39- protected function hasSnapshot ( $ path , $ id ): bool
39+ protected function shouldUpdateSnapshots ( ): bool
4040 {
41- if (! file_exists ($ path )) {
42- return false ;
43- }
44-
45- $ snapshots = require $ path ;
46-
47- return isset ($ snapshots [$ id ]);
48- }
49-
50- protected function getSnapshot ($ path , $ id )
51- {
52- $ snapshots = require $ path ;
53-
54- return $ snapshots [$ id ];
55- }
56-
57- protected function updateOrCreateSnapshot ($ path , $ id , $ serializable )
58- {
59-
41+ return getenv ('UPDATE_SNAPSHOTS ' );
6042 }
6143
6244 protected function serializeForSnapshot ($ serializable )
0 commit comments