Skip to content

Commit 8ada83a

Browse files
committed
PHPCS: whitelist some code for select sniffs
Includes minor documentation fix.
1 parent 56176c7 commit 8ada83a

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

features/bootstrap/support.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ function assert_regex( $regex, $actual ) {
1616
}
1717

1818
function assert_equals( $expected, $actual ) {
19+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison.
1920
if ( $expected != $actual ) {
2021
throw new Exception( 'Actual value: ' . var_export( $actual, true ) );
2122
}
2223
}
2324

2425
function assert_not_equals( $expected, $actual ) {
26+
// phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison -- Deliberate loose comparison.
2527
if ( $expected == $actual ) {
2628
throw new Exception( 'Actual value: ' . var_export( $actual, true ) );
2729
}

features/extra/no-mail.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
<?php
2-
3-
/*
2+
/**
43
* This file is copied as amu-plugin into new WP installs to reroute normal
54
* mails into log entries.
65
*/
76

7+
/**
8+
* Replace WP native pluggable wp_mail function for test purposes.
9+
*
10+
* @param string $to Email address.
11+
*
12+
* @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound -- WP native function.
13+
*/
814
function wp_mail( $to ) {
915
// Log for testing purposes
1016
WP_CLI::log( "WP-CLI test suite: Sent email to {$to}." );
1117
}
12-
18+
// phpcs:enable

tests/bootstrap.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<?php
22
define( 'WP_CLI', true );
33
define( 'WP_CLI_TESTS_ROOT', dirname( __DIR__ ) );
4+
5+
// These constants are actively used by dependent projects, renaming them would be a BC-break.
6+
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
47
define(
58
'VENDOR_DIR',
69
file_exists( WP_CLI_TESTS_ROOT . '/vendor/autoload.php' )
710
? WP_CLI_TESTS_ROOT . '/vendor'
811
: WP_CLI_TESTS_ROOT . '/../..'
912
);
1013
define( 'PACKAGE_ROOT', VENDOR_DIR . '/..' );
14+
// phpcs:enable
1115

1216
define(
1317
'WP_CLI_ROOT',

0 commit comments

Comments
 (0)