File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -373,7 +373,7 @@ public function generate_directory_list() {
373373 * @param string $report The full report.
374374 * @return string The cleaned report.
375375 */
376- private function clean_report ( $ report ) {
376+ public function clean_report ( $ report ) {
377377 // Remove unnecessary overview.
378378 $ report = preg_replace ( '/Time:.+\n/si ' , '' , $ report );
379379
Original file line number Diff line number Diff line change 1+ <?php
2+ class TestCleanReport extends WP_UnitTestCase {
3+
4+ private $ wpephpc ;
5+
6+ public function setUp () {
7+ $ root_dir = realpath ( __DIR__ . '/../../ ' );
8+
9+ $ this ->wpephpc = new \WPEPHPCompat ( $ root_dir );
10+ }
11+
12+ public function test_clean_report_time () {
13+ $ report = "Time: 323 \n" ;
14+
15+ $ output = $ this ->wpephpc ->clean_report ( $ report );
16+ $ this ->assertEquals ( '' , $ output );
17+ }
18+
19+ public function test_clean_report_newlines () {
20+ $ report = "\n\n\n\n" ;
21+
22+ $ output = $ this ->wpephpc ->clean_report ( $ report );
23+ $ this ->assertEquals ( '' , $ output );
24+ }
25+
26+ public function test_clean_report_time_and_newlines () {
27+ $ report = "\n\n\nhello \nTime: 323 \n\n\n\n\n" ;
28+
29+ $ output = $ this ->wpephpc ->clean_report ( $ report );
30+ $ this ->assertEquals ( 'hello ' , $ output );
31+ }
32+ }
You can’t perform that action at this time.
0 commit comments