@@ -479,7 +479,7 @@ public function it_doesnt_create_a_regular_snapshot_and_mismatches_if_asked()
479479 $ this ->expectFail (
480480 $ mockTrait ,
481481 "Snapshot \"MatchesSnapshotTest__it_doesnt_create_a_regular_snapshot_and_mismatches_if_asked__1.txt \" does not exist. \n" .
482- ' You can automatically create it by removing ` -d --without-creating-snapshots` of PHPUnit \ 's CLI arguments. '
482+ " You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or ` -d --without-creating-snapshots` of PHPUnit's CLI arguments. "
483483 );
484484
485485 $ mockTrait ->assertMatchesSnapshot ('Bar ' );
@@ -495,7 +495,39 @@ public function it_doesnt_create_a_file_snapshot_and_mismatches_if_asked()
495495 $ this ->expectFail (
496496 $ mockTrait ,
497497 "Snapshot \"MatchesSnapshotTest__it_doesnt_create_a_file_snapshot_and_mismatches_if_asked__1.jpg_failed.jpg \" does not exist. \n" .
498- 'You can automatically create it by removing `-d --without-creating-snapshots` of PHPUnit \'s CLI arguments. '
498+ "You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or `-d --without-creating-snapshots` of PHPUnit's CLI arguments. "
499+ );
500+
501+ $ mockTrait ->assertMatchesFileSnapshot (__DIR__ .'/stubs/test_files/friendly_man.jpg ' );
502+ }
503+
504+ /** @test */
505+ public function it_doesnt_create_a_regular_snapshot_and_mismatches_if_asked_with_env_var ()
506+ {
507+ putenv ('CREATE_SNAPSHOTS=false ' );
508+
509+ $ mockTrait = $ this ->getMatchesSnapshotMock ();
510+
511+ $ this ->expectFail (
512+ $ mockTrait ,
513+ "Snapshot \"MatchesSnapshotTest__it_doesnt_create_a_regular_snapshot_and_mismatches_if_asked_with_env_var__1.txt \" does not exist. \n" .
514+ "You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or `-d --without-creating-snapshots` of PHPUnit's CLI arguments. "
515+ );
516+
517+ $ mockTrait ->assertMatchesSnapshot ('Bar ' );
518+ }
519+
520+ /** @test */
521+ public function it_doesnt_create_a_file_snapshot_and_mismatches_if_asked_with_env_var ()
522+ {
523+ putenv ('CREATE_SNAPSHOT=false ' );
524+
525+ $ mockTrait = $ this ->getMatchesSnapshotMock ();
526+
527+ $ this ->expectFail (
528+ $ mockTrait ,
529+ "Snapshot \"MatchesSnapshotTest__it_doesnt_create_a_file_snapshot_and_mismatches_if_asked_with_env_var__1.jpg_failed.jpg \" does not exist. \n" .
530+ "You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or `-d --without-creating-snapshots` of PHPUnit's CLI arguments. "
499531 );
500532
501533 $ mockTrait ->assertMatchesFileSnapshot (__DIR__ .'/stubs/test_files/friendly_man.jpg ' );
0 commit comments