Skip to content

Commit d55ee0c

Browse files
committed
Add tests for clean_report.
1 parent c5f3119 commit d55ee0c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
}

0 commit comments

Comments
 (0)