diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 424f4095..0b06835d 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -19,6 +19,7 @@ + diff --git a/bin/unit-tests b/bin/unit-tests index 0c84e924..8ffc5acc 100755 --- a/bin/unit-tests +++ b/bin/unit-tests @@ -17,7 +17,7 @@ # if [[ $(php -r 'echo PHP_VERSION_ID;') -ge 80100 ]]; then - "$(pwd)/vendor/bin/phpunit" --filter WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests $@ + "$(pwd)/vendor/bin/phpunit" --filter=WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage --no-configuration --bootstrap=./tests/bootstrap.php --dont-report-useless-tests $@ else - "$(pwd)/vendor/bin/phpunit" --filter WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage $@ + "$(pwd)/vendor/bin/phpunit" --filter=WordPressVIPMinimum "$(pwd)/vendor/squizlabs/php_codesniffer/tests/AllTests.php" --no-coverage $@ fi diff --git a/tests/RulesetTest.php b/tests/RulesetTest.php index d67a3454..ca9b15d0 100644 --- a/tests/RulesetTest.php +++ b/tests/RulesetTest.php @@ -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 ) ) { @@ -143,11 +146,12 @@ 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. + '%1$s%2$s --severity=1 --standard=%3$s --report=json --runtime-set minimum_supported_wp_version 0 ./%3$s/ruleset-test.inc', + $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 );