Skip to content

Commit fc01507

Browse files
author
Govind Kumar
committed
Merge branch 'master' of http://github.com/wp-cli/entity-command into issue/4382
2 parents 2ab1a72 + 0dfecf2 commit fc01507

40 files changed

+648
-127
lines changed

.github/PULL_REQUEST_TEMPLATE

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
Thanks for submitting a pull request!
44

5+
Please review our contributing guidelines if you haven't recently: https://make.wordpress.org/cli/handbook/contributing/#creating-a-pull-request
6+
57
Here's an overview to our process:
68

7-
1. One of the project committers will soon provide a code review.
8-
2. You are expected to address the code review comments in a timely manner.
9+
1. One of the project committers will soon provide a code review: https://make.wordpress.org/cli/handbook/code-review/
10+
2. You are expected to address the code review comments in a timely manner (if we don't hear from you in two weeks, we'll consider your pull request abandoned).
911
3. Please make sure to include functional tests for your changes.
1012
4. The reviewing committer will merge your pull request as soon as it passes code review (and provided it fits within the scope of the project).
1113

.github/settings.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Used by Probot Settings: https://probot.github.io/apps/settings/
2+
repository:
3+
description: Manage WordPress core entities.
4+
labels:
5+
- name: scope:documentation
6+
color: 0e8a16
7+
- name: scope:testing
8+
color: 5319e7
9+
- name: good-first-issue
10+
color: eb6420
11+
- name: state:unconfirmed
12+
color: bfe5bf
13+
- name: state:unsupported
14+
color: bfe5bf
15+
- name: command:comment
16+
color: c5def5
17+
- name: command:comment-meta
18+
color: c5def5
19+
- name: command:menu
20+
color: c5def5
21+
- name: command:menu-item
22+
color: c5def5
23+
- name: command:menu-location
24+
color: c5def5
25+
- name: command:network-meta
26+
color: c5def5
27+
- name: command:option
28+
color: c5def5
29+
- name: command:option-add
30+
color: c5def5
31+
- name: command:option-delete
32+
color: c5def5
33+
- name: command:option-get
34+
color: c5def5
35+
- name: command:option-list
36+
color: c5def5
37+
- name: command:option-update
38+
color: c5def5
39+
- name: command:post
40+
color: c5def5
41+
- name: command:post-meta
42+
color: c5def5
43+
- name: command:post-term
44+
color: c5def5
45+
- name: command:post-type
46+
color: c5def5
47+
- name: command:site
48+
color: c5def5
49+
- name: command:site-empty
50+
color: c5def5
51+
- name: command:taxonomy
52+
color: c5def5
53+
- name: command:term
54+
color: c5def5
55+
- name: command:term-meta
56+
color: c5def5
57+
- name: command:user
58+
color: c5def5
59+
- name: command:user-meta
60+
color: c5def5
61+
- name: command:user-term
62+
color: c5def5

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ node_modules/
44
vendor/
55
*.zip
66
*.tar.gz
7+
composer.lock

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ env:
2424

2525
matrix:
2626
include:
27+
- php: 7.2
28+
env: WP_VERSION=nightly
2729
- php: 7.1
2830
env: WP_VERSION=latest
2931
- php: 7.0

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,6 @@ wp network meta
180180

181181

182182

183-
184-
185183
### wp option
186184

187185
Retrieves and sets site options, including plugin and WordPress settings.

bin/install-package-tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -ex
55
install_db() {
66
mysql -e 'CREATE DATABASE IF NOT EXISTS wp_cli_test;' -uroot
77
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot
8+
mysql -e 'GRANT ALL PRIVILEGES ON wp_cli_test_scaffold.* TO "wp_cli_test"@"localhost" IDENTIFIED BY "password1"' -uroot
89
}
910

1011
install_db

entity-command.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,7 @@
5454
);
5555

5656
WP_CLI::add_command( 'user term', 'User_Term_Command' );
57+
58+
if ( class_exists( 'WP_CLI\Dispatcher\CommandNamespace' ) ) {
59+
WP_CLI::add_command( 'network', 'Network_Namespace' );
60+
}

features/bootstrap/FeatureContext.php

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,12 @@ private static function get_process_env_variables() {
131131
if ( $php_args = getenv( 'WP_CLI_PHP_ARGS' ) ) {
132132
$env['WP_CLI_PHP_ARGS'] = $php_args;
133133
}
134+
if ( $php_used = getenv( 'WP_CLI_PHP_USED' ) ) {
135+
$env['WP_CLI_PHP_USED'] = $php_used;
136+
}
137+
if ( $php = getenv( 'WP_CLI_PHP' ) ) {
138+
$env['WP_CLI_PHP'] = $php;
139+
}
134140
if ( $travis_build_dir = getenv( 'TRAVIS_BUILD_DIR' ) ) {
135141
$env['TRAVIS_BUILD_DIR'] = $travis_build_dir;
136142
}
@@ -526,7 +532,8 @@ public function background_proc( $cmd ) {
526532
$status = proc_get_status( $proc );
527533

528534
if ( !$status['running'] ) {
529-
throw new RuntimeException( stream_get_contents( $pipes[2] ) );
535+
$stderr = is_resource( $pipes[2] ) ? ( ': ' . stream_get_contents( $pipes[2] ) ) : '';
536+
throw new RuntimeException( sprintf( "Failed to start background process '%s'%s.", $cmd, $stderr ) );
530537
} else {
531538
$this->running_procs[] = $proc;
532539
}
@@ -617,7 +624,8 @@ public function install_wp( $subdir = '' ) {
617624
'title' => 'WP CLI Site',
618625
'admin_user' => 'admin',
619626
'admin_email' => '[email protected]',
620-
'admin_password' => 'password1'
627+
'admin_password' => 'password1',
628+
'skip-email' => true,
621629
);
622630

623631
$install_cache_path = '';
@@ -658,7 +666,8 @@ public function install_wp_with_composer( $vendor_directory = 'vendor' ) {
658666
'title' => 'WP CLI Site with both WordPress and wp-cli as Composer dependencies',
659667
'admin_user' => 'admin',
660668
'admin_email' => '[email protected]',
661-
'admin_password' => 'password1'
669+
'admin_password' => 'password1',
670+
'skip-email' => true,
662671
);
663672

664673
$this->proc( 'wp core install', $install_args )->run_check();
@@ -686,26 +695,13 @@ public function composer_require_current_wp_cli() {
686695
$this->composer_command( 'require wp-cli/wp-cli:dev-master --optimize-autoloader --no-interaction' );
687696
}
688697

689-
public function get_php_binary() {
690-
if ( getenv( 'WP_CLI_PHP_USED' ) )
691-
return getenv( 'WP_CLI_PHP_USED' );
692-
693-
if ( getenv( 'WP_CLI_PHP' ) )
694-
return getenv( 'WP_CLI_PHP' );
695-
696-
if ( defined( 'PHP_BINARY' ) )
697-
return PHP_BINARY;
698-
699-
return 'php';
700-
}
701-
702698
public function start_php_server( $subdir = '' ) {
703699
$dir = $this->variables['RUN_DIR'] . '/';
704700
if ( $subdir ) {
705701
$dir .= trim( $subdir, '/' ) . '/';
706702
}
707703
$cmd = Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
708-
$this->get_php_binary(),
704+
Utils\get_php_binary(),
709705
'localhost:8080',
710706
$dir,
711707
get_cfg_var( 'cfg_file_path' ),

features/bootstrap/Process.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,20 @@ public function run_check() {
115115

116116
return $r;
117117
}
118+
119+
/**
120+
* Run the command, but throw an Exception on error.
121+
* Same as `run_check()` above, but checks the correct stderr.
122+
*
123+
* @return ProcessRun
124+
*/
125+
public function run_check_stderr() {
126+
$r = $this->run();
127+
128+
if ( $r->return_code || ! empty( $r->stderr ) ) {
129+
throw new \RuntimeException( $r );
130+
}
131+
132+
return $r;
133+
}
118134
}

features/bootstrap/support.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
// Utility functions used by Behat steps
44

5+
function assertRegExp( $regex, $actual ) {
6+
if ( ! preg_match( $regex, $actual ) ) {
7+
throw new Exception( "Actual value: " . var_export( $actual, true ) );
8+
}
9+
}
10+
511
function assertEquals( $expected, $actual ) {
612
if ( $expected != $actual ) {
713
throw new Exception( "Actual value: " . var_export( $actual, true ) );

0 commit comments

Comments
 (0)