Skip to content

Commit c1404c7

Browse files
committed
Update Readme.
1 parent 0d7fb2d commit c1404c7

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

README.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ FAILURES!
156156
Tests: 1, Assertions: 1, Failures: 1.
157157
```
158158

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`.
160160

161161
```
162162
> ./vendor/bin/phpunit -d --update-snapshots
@@ -278,14 +278,27 @@ $this->assertMatchesSnapshot($something->toYaml(), new MyYamlDriver());
278278

279279
When running your tests in Continuous Integration you would possibly want to disable the creation of snapshots.
280280

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.
282282

283283
```bash
284284
> ./vendor/bin/phpunit -d --without-creating-snapshots
285285

286286
1) ExampleTest::test_it_matches_a_string
287287
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.
289302
```
290303

291304
### A note for Windows users

0 commit comments

Comments
 (0)