Skip to content

Commit e2e1635

Browse files
authored
Merge pull request #42 from wp-cli/update-wp-cli-tests-v4
2 parents 1a75d39 + 3f592b0 commit e2e1635

File tree

3 files changed

+60
-4
lines changed

3 files changed

+60
-4
lines changed

admin-command.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Open /wp-admin/ in a browser.
99
*/
10-
$wp_admin = function() {
10+
function wp_cli_admin_command() {
1111
switch ( strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
1212
case 'DAR':
1313
$exec = 'open';
@@ -19,5 +19,5 @@
1919
$exec = 'xdg-open';
2020
}
2121
passthru( $exec . ' ' . escapeshellarg( admin_url() ) );
22-
};
23-
WP_CLI::add_command( 'admin', $wp_admin );
22+
}
23+
WP_CLI::add_command( 'admin', 'wp_cli_admin_command' );

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"wp-cli/wp-cli": "^2"
99
},
1010
"require-dev": {
11-
"wp-cli/wp-cli-tests": "^3.0.11"
11+
"wp-cli/wp-cli-tests": "^4"
1212
},
1313
"config": {
1414
"process-timeout": 7200,
@@ -38,6 +38,7 @@
3838
"behat-rerun": "rerun-behat-tests",
3939
"lint": "run-linter-tests",
4040
"phpcs": "run-phpcs-tests",
41+
"phpcbf": "run-phpcbf-cleanup",
4142
"phpunit": "run-php-unit-tests",
4243
"prepare-tests": "install-package-tests",
4344
"test": [

phpcs.xml.dist

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?xml version="1.0"?>
2+
<ruleset name="WP-CLI-cache">
3+
<description>Custom ruleset for WP-CLI admin-command</description>
4+
5+
<!--
6+
#############################################################################
7+
COMMAND LINE ARGUMENTS
8+
For help understanding this file: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Annotated-ruleset.xml
9+
For help using PHPCS: https://github.com/squizlabs/PHP_CodeSniffer/wiki/Usage
10+
#############################################################################
11+
-->
12+
13+
<!-- What to scan. -->
14+
<file>.</file>
15+
16+
<!-- Show progress. -->
17+
<arg value="p"/>
18+
19+
<!-- Strip the filepaths down to the relevant bit. -->
20+
<arg name="basepath" value="./"/>
21+
22+
<!-- Check up to 8 files simultaneously. -->
23+
<arg name="parallel" value="8"/>
24+
25+
<!--
26+
#############################################################################
27+
USE THE WP_CLI_CS RULESET
28+
#############################################################################
29+
-->
30+
31+
<rule ref="WP_CLI_CS"/>
32+
33+
<!--
34+
#############################################################################
35+
PROJECT SPECIFIC CONFIGURATION FOR SNIFFS
36+
#############################################################################
37+
-->
38+
39+
<!-- For help understanding the `testVersion` configuration setting:
40+
https://github.com/PHPCompatibility/PHPCompatibility#sniffing-your-code-for-compatibility-with-specific-php-versions -->
41+
<config name="testVersion" value="5.6-"/>
42+
43+
<!-- Make this sniff slightly less finicky. The WP Core default is 40. -->
44+
<rule ref="Generic.Formatting.MultipleStatementAlignment">
45+
<properties>
46+
<property name="maxPadding" value="20"/>
47+
</properties>
48+
</rule>
49+
50+
<!-- Exclude existing classes from the prefix rule as it would break BC to prefix them now. -->
51+
<rule ref="WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedClassFound">
52+
<exclude-pattern>*/src/Admin_Command\.php$</exclude-pattern>
53+
</rule>
54+
55+
</ruleset>

0 commit comments

Comments
 (0)