Skip to content

Commit 27803cb

Browse files
Better snapshots
1 parent 5f0923f commit 27803cb

6 files changed

+101
-101
lines changed

tests/SnapshotTextDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ private function applyPregReplace(mixed $data): ?string
2424
'/FAILED(.*?)>(.*?)[ ]{3,}([\S]+)/' => 'FAILED$1>$2 $3',
2525
'/─[\S]*─/' => '───────────────────',
2626
'/([\d]+.[\d]+)%/' => 'SOME-PERCENTAGE',
27-
'/[ ]{3,}\(SOME-PERCENTAGE/' => '(SOME-PERCENTAGE',
27+
'/[ ]{3,}/' => ' ',
2828
];
2929

3030
foreach ($regexes as $regex => $replacement) {

tests/__snapshots__/OutputTest__testPrintCompactModeAtRunTime__1.txt

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@
55
Failed asserting that false is true.
66

77
at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
8-
19▕
9-
20▕ public function testFail(): void
10-
21▕ {
11-
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
12-
➜ 23▕ $this->assertTrue(false);
13-
24▕ }
14-
25▕
15-
26▕ public function testFailWithDiff(): void
16-
27▕ {
8+
19▕
9+
20▕ public function testFail(): void
10+
21▕ {
11+
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
12+
➜ 23▕ $this->assertTrue(false);
13+
24▕ }
14+
25▕
15+
26▕ public function testFailWithDiff(): void
16+
27▕ {
1717

1818
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23
1919

2020
───────────────────
2121
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
2222
Failed asserting that two arrays are equal.
2323
Array (
24-
- 0 => 'one'
25-
- 1 => 'two'
26-
+ 0 => 'two'
27-
+ 1 => 'one'
24+
- 0 => 'one'
25+
- 1 => 'two'
26+
+ 0 => 'two'
27+
+ 1 => 'one'
2828
)
2929

3030

3131
at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
32-
27▕ {
33-
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
34-
29▕ $this->assertEquals(
35-
30▕ ['one', 'two'],
36-
➜ 31▕ ['two', 'one']
37-
32▕ );
38-
33▕ }
39-
34▕
40-
35▕ public function testError(): void
32+
27▕ {
33+
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
34+
29▕ $this->assertEquals(
35+
30▕ ['one', 'two'],
36+
➜ 31▕ ['two', 'one']
37+
32▕ );
38+
33▕ }
39+
34▕
40+
35▕ public function testError(): void
4141

4242
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31
4343

@@ -46,18 +46,18 @@
4646
error
4747

4848
at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
49-
34▕
50-
35▕ public function testError(): void
51-
36▕ {
52-
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
53-
➜ 38▕ throw new \Exception('error');
54-
39▕ }
55-
40▕
56-
41▕ public function testRisky(): void
57-
42▕ {
49+
34▕
50+
35▕ public function testError(): void
51+
36▕ {
52+
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
53+
➜ 38▕ throw new \Exception('error');
54+
39▕ }
55+
40▕
56+
41▕ public function testRisky(): void
57+
42▕ {
5858

5959
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38
6060

6161

62-
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
62+
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
6363
Duration: DURATION-IN-SECONDS

tests/__snapshots__/OutputTest__testPrintCompactMode__1.txt

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,39 @@
55
Failed asserting that false is true.
66

77
at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
8-
19▕
9-
20▕ public function testFail(): void
10-
21▕ {
11-
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
12-
➜ 23▕ $this->assertTrue(false);
13-
24▕ }
14-
25▕
15-
26▕ public function testFailWithDiff(): void
16-
27▕ {
8+
19▕
9+
20▕ public function testFail(): void
10+
21▕ {
11+
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
12+
➜ 23▕ $this->assertTrue(false);
13+
24▕ }
14+
25▕
15+
26▕ public function testFailWithDiff(): void
16+
27▕ {
1717

1818
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23
1919

2020
───────────────────
2121
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
2222
Failed asserting that two arrays are equal.
2323
Array (
24-
- 0 => 'one'
25-
- 1 => 'two'
26-
+ 0 => 'two'
27-
+ 1 => 'one'
24+
- 0 => 'one'
25+
- 1 => 'two'
26+
+ 0 => 'two'
27+
+ 1 => 'one'
2828
)
2929

3030

3131
at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
32-
27▕ {
33-
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
34-
29▕ $this->assertEquals(
35-
30▕ ['one', 'two'],
36-
➜ 31▕ ['two', 'one']
37-
32▕ );
38-
33▕ }
39-
34▕
40-
35▕ public function testError(): void
32+
27▕ {
33+
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
34+
29▕ $this->assertEquals(
35+
30▕ ['one', 'two'],
36+
➜ 31▕ ['two', 'one']
37+
32▕ );
38+
33▕ }
39+
34▕
40+
35▕ public function testError(): void
4141

4242
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31
4343

@@ -46,18 +46,18 @@
4646
error
4747

4848
at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
49-
34▕
50-
35▕ public function testError(): void
51-
36▕ {
52-
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
53-
➜ 38▕ throw new \Exception('error');
54-
39▕ }
55-
40▕
56-
41▕ public function testRisky(): void
57-
42▕ {
49+
34▕
50+
35▕ public function testError(): void
51+
36▕ {
52+
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
53+
➜ 38▕ throw new \Exception('error');
54+
39▕ }
55+
40▕
56+
41▕ public function testRisky(): void
57+
42▕ {
5858

5959
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38
6060

6161

62-
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
62+
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
6363
Duration: DURATION-IN-SECONDS

tests/__snapshots__/OutputTest__testPrintWithoutConfig__1.txt

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,39 @@
1616
Failed asserting that false is true.
1717

1818
at tests/ExampleTests/TestThatHasAllStatusesTest.php:23
19-
19▕
20-
20▕ public function testFail(): void
21-
21▕ {
22-
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
23-
➜ 23▕ $this->assertTrue(false);
24-
24▕ }
25-
25▕
26-
26▕ public function testFailWithDiff(): void
27-
27▕ {
19+
19▕
20+
20▕ public function testFail(): void
21+
21▕ {
22+
22▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
23+
➜ 23▕ $this->assertTrue(false);
24+
24▕ }
25+
25▕
26+
26▕ public function testFailWithDiff(): void
27+
27▕ {
2828

2929
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:23
3030

3131
───────────────────
3232
FAILED Tests\ExampleTests\TestThatHasAllStatusesTest > fail with diff
3333
Failed asserting that two arrays are equal.
3434
Array (
35-
- 0 => 'one'
36-
- 1 => 'two'
37-
+ 0 => 'two'
38-
+ 1 => 'one'
35+
- 0 => 'one'
36+
- 1 => 'two'
37+
+ 0 => 'two'
38+
+ 1 => 'one'
3939
)
4040

4141

4242
at tests/ExampleTests/TestThatHasAllStatusesTest.php:31
43-
27▕ {
44-
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
45-
29▕ $this->assertEquals(
46-
30▕ ['one', 'two'],
47-
➜ 31▕ ['two', 'one']
48-
32▕ );
49-
33▕ }
50-
34▕
51-
35▕ public function testError(): void
43+
27▕ {
44+
28▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
45+
29▕ $this->assertEquals(
46+
30▕ ['one', 'two'],
47+
➜ 31▕ ['two', 'one']
48+
32▕ );
49+
33▕ }
50+
34▕
51+
35▕ public function testError(): void
5252

5353
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:31
5454

@@ -57,18 +57,18 @@
5757
error
5858

5959
at tests/ExampleTests/TestThatHasAllStatusesTest.php:38
60-
34▕
61-
35▕ public function testError(): void
62-
36▕ {
63-
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
64-
➜ 38▕ throw new \Exception('error');
65-
39▕ }
66-
40▕
67-
41▕ public function testRisky(): void
68-
42▕ {
60+
34▕
61+
35▕ public function testError(): void
62+
36▕ {
63+
37▕ usleep(self::SLEEP_IN_MICRO_SECONDS);
64+
➜ 38▕ throw new \Exception('error');
65+
39▕ }
66+
40▕
67+
41▕ public function testRisky(): void
68+
42▕ {
6969

7070
1 tests/ExampleTests/TestThatHasAllStatusesTest.php:38
7171

7272

73-
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
73+
Tests: 3 failed, 1 risky, 1 incomplete, 1 skipped, 3 passed (7 assertions)
7474
Duration: DURATION-IN-SECONDS

tests/__snapshots__/OutputTest__testWithProfilingAtRunTime__1.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
✓ do basic assertions DURATION-IN-SECONDS
44
✓ do some more assertions DURATION-IN-SECONDS
55

6-
Tests: 2 passed (4 assertions)
6+
Tests: 2 passed (4 assertions)
77
Duration: DURATION-IN-SECONDS
88

99
Top 10 slowest tests:
1010
Tests\ExampleTests\TestThatPassesTest > do basic assertions DURATION-IN-SECONDS
1111
Tests\ExampleTests\TestThatPassesTest > do some more assertions DURATION-IN-SECONDS
1212
───────────────────
13-
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS
13+
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS

tests/__snapshots__/OutputTest__testWithProfiling__1.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
✓ do basic assertions DURATION-IN-SECONDS
44
✓ do some more assertions DURATION-IN-SECONDS
55

6-
Tests: 2 passed (4 assertions)
6+
Tests: 2 passed (4 assertions)
77
Duration: DURATION-IN-SECONDS
88

99
Top 10 slowest tests:
1010
Tests\ExampleTests\TestThatPassesTest > do basic assertions DURATION-IN-SECONDS
1111
Tests\ExampleTests\TestThatPassesTest > do some more assertions DURATION-IN-SECONDS
1212
───────────────────
13-
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS
13+
(SOME-PERCENTAGE of DURATION-IN-SECONDS) DURATION-IN-SECONDS

0 commit comments

Comments
 (0)