Skip to content

Commit

Permalink
Ruleset tests: Add label before test runs
Browse files Browse the repository at this point in the history
Make it clear which ruleset being tested, even on a test failure.
  • Loading branch information
GaryJones committed Jan 30, 2023
1 parent 5e805d6 commit b57c9fd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/RulesetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ public function __construct( $ruleset, $expected = [] ) {
$this->phpcs_bin = realpath( $phpcs_bin );
}

// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
printf( 'Testing the ' . $this->ruleset . ' ruleset.' . PHP_EOL );

$output = $this->collect_phpcs_result();

if ( ! is_object( $output ) || empty( $output ) ) {
Expand Down Expand Up @@ -144,10 +147,11 @@ private function collect_phpcs_result() {

$shell = sprintf(
'%1$s%2$s --severity=1 --standard=%3$s --report=json ./%3$s/ruleset-test.inc',
$php, // Current PHP executable if avaiable.
$php, // Current PHP executable if available.
$this->phpcs_bin,
$this->ruleset
);

// phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_shell_exec -- This is test code, not production.
$output = shell_exec( $shell );

Expand Down

0 comments on commit b57c9fd

Please sign in to comment.