You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,7 +156,7 @@ FAILURES!
156
156
Tests: 1, Assertions: 1, Failures: 1.
157
157
```
158
158
159
-
When we expect a changed value, we need to tell the test runner to update the existing snapshots instead of failing the test. This is possible by adding a`-d --update-snapshots` flag to the `phpunit` command.
159
+
When we expect a changed value, we need to tell the test runner to update the existing snapshots instead of failing the test. This is possible by adding a`-d --update-snapshots` flag to the `phpunit` command, or setting the `UPDATE_SNAPSHOTS` env var to `true`.
160
160
161
161
```
162
162
> ./vendor/bin/phpunit -d --update-snapshots
@@ -278,14 +278,27 @@ $this->assertMatchesSnapshot($something->toYaml(), new MyYamlDriver());
278
278
279
279
When running your tests in Continuous Integration you would possibly want to disable the creation of snapshots.
280
280
281
-
By using the `--without-creating-snapshots` parameter, PHPUnit will fail if the snapshots don't exist.
281
+
By using the `--without-creating-snapshots` parameter or by setting the `CREATE_SNAPSHOTS` env var to `false`, PHPUnit will fail if the snapshots don't exist.
Snapshot "ExampleTest__test_it_matches_a_string__1.txt" does not exist.
288
-
You can automatically create it by removing `-d --no-create-snapshots` of PHPUnit's CLI arguments.
288
+
You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or `-d --no-create-snapshots` of PHPUnit's CLI arguments.
289
+
```
290
+
291
+
### Usage with parallel testing
292
+
293
+
If you want to run your test in parallel with a tool like [Paratest](https://github.com/paratestphp/paratest), ou with the `php artisan test --parallel` command of Laravel, you will have to use the environment variables.
294
+
295
+
296
+
```bash
297
+
> CREATE_SNAPSHOTS=false php artisan test --parallel
298
+
299
+
1) ExampleTest::test_it_matches_a_string
300
+
Snapshot "ExampleTest__test_it_matches_a_string__1.txt" does not exist.
301
+
You can automatically create it by removing the `CREATE_SNAPSHOT=false` env var, or `-d --no-create-snapshots` of PHPUnit's CLI arguments.
0 commit comments