File tree Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Expand file tree Collapse file tree 2 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 1+ UPGRADE FROM 3.x to 4.0
2+ =======================
3+
4+ ### Slowness report changes formatting of slow class names
5+
6+ Prior to 4.0 the slowness report displayed the qualified class name in a
7+ human-readable format as normally seen in code:
8+
9+ 1. 800ms to run JohnKary\PHPUnit\Listener\Tests\SomeSlowTest:testWithDataProvider with data set "Rock"
10+
11+ After 4.0 the slowness report displays class names in a format ready to be
12+ used with PHPUnit's [ --filter option] ( https://phpunit.readthedocs.io/en/9.5/textui.html?highlight=filter )
13+ by adding slashes to the namespace delimiter and adding a colon between the
14+ class and method name:
15+
16+ 1. 800ms to run JohnKary\\PHPUnit\\Listener\\Tests\\SomeSlowTest::testWithDataProvider with data set "Rock"
17+
18+ An individual slow test case can now be re-run by copying and pasting the output
19+ into a new command:
20+
21+ vendor/bin/phpunit --filter 'JohnKary\\PHPUnit\\Listener\\Tests\\SomeSlowTest::testWithDataProvider with data set "Rock"'
22+
23+ Note that PHPUnit uses single quotes for the ` --filter ` option value. See the
24+ [ --filter option documentation] ( https://phpunit.readthedocs.io/en/9.5/textui.html?highlight=filter )
25+ for all supported matching patterns.
26+
127UPGRADE FROM 2.x to 3.0
228=======================
329
Original file line number Diff line number Diff line change @@ -151,11 +151,14 @@ protected function toMilliseconds(float $time): int
151151 }
152152
153153 /**
154- * Label describing a test.
154+ * Label describing a slow test case. Formatted to support copy/paste with
155+ * PHPUnit's --filter CLI option:
156+ *
157+ * vendor/bin/phpunit --filter 'JohnKary\\PHPUnit\\Listener\\Tests\\SomeSlowTest::testWithDataProvider with data set "Rock"'
155158 */
156159 protected function makeLabel (TestCase $ test ): string
157160 {
158- return sprintf ('%s::%s ' , get_class ($ test ), $ test ->getName ());
161+ return sprintf ('%s::%s ' , addslashes ( get_class ($ test) ), $ test ->getName ());
159162 }
160163
161164 /**
You can’t perform that action at this time.
0 commit comments