Skip to content

Commit

Permalink
Merge pull request #92 from wp-cli/update-readme-tests
Browse files Browse the repository at this point in the history
Update scaffolded README and tests with latest
  • Loading branch information
schlessera authored Sep 29, 2017
2 parents 7081611 + 26acbc0 commit 50f907c
Show file tree
Hide file tree
Showing 5 changed files with 246 additions and 76 deletions.
37 changes: 34 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ Lists, creates, assigns, and deletes the active theme's navigation menus.
wp menu
~~~

See the [Navigation Menus](https://developer.wordpress.org/themes/functionality/navigation-menus/) reference in the Theme Handbook.

**EXAMPLES**

# Create a new menu
Expand Down Expand Up @@ -188,6 +190,8 @@ Retrieves and sets site options, including plugin and WordPress settings.
wp option
~~~

See the [Plugin Settings API](https://developer.wordpress.org/plugins/settings/settings-api/) and the [Theme Options](https://developer.wordpress.org/themes/customize-api/) for more information on adding customized options.

**EXAMPLES**

# Get site URL.
Expand Down Expand Up @@ -324,7 +328,7 @@ wp option get <key> [--format=<format>]
List options and their values.

~~~
wp option list [--search=<pattern>] [--exclude=<pattern>] [--autoload=<value>] [--transients] [--field=<field>] [--fields=<fields>] [--format=<format>]
wp option list [--search=<pattern>] [--exclude=<pattern>] [--autoload=<value>] [--transients] [--field=<field>] [--fields=<fields>] [--format=<format>] [--orderby=<fields>] [--order=<order>]
~~~

**OPTIONS**
Expand Down Expand Up @@ -360,6 +364,25 @@ wp option list [--search=<pattern>] [--exclude=<pattern>] [--autoload=<value>] [
- total_bytes
---

[--orderby=<fields>]
Set orderby which field.
---
default: option_id
options:
- option_id
- option_name
- option_value
---

[--order=<order>]
Set ascending or descending order.
---
default: asc
options:
- asc
- desc
---

**AVAILABLE FIELDS**

This field will be displayed by default for each matching option:
Expand Down Expand Up @@ -543,12 +566,14 @@ wp post term

### wp post-type

Retrieves details on the site's registered post-types.
Retrieves details on the site's registered post types.

~~~
wp post-type
~~~

Get information on WordPress' built-in and the site's [custom post types](https://developer.wordpress.org/plugins/post-types/).

**EXAMPLES**

# Get details about a post type
Expand Down Expand Up @@ -645,6 +670,8 @@ Retrieves information about registered taxonomies.
wp taxonomy
~~~

See references for [built-in taxonomies](https://developer.wordpress.org/themes/basics/categories-tags-custom-taxonomies/) and [custom taxonomies](https://developer.wordpress.org/plugins/taxonomies/working-with-custom-taxonomies/).

**EXAMPLES**

# List all taxonomies with 'post' object type.
Expand All @@ -665,12 +692,14 @@ wp taxonomy

### wp term

Manages taxonomy terms and term meta, including create, delete, and list.
Manages taxonomy terms and term meta, with create, delete, and list commands.

~~~
wp term
~~~

See reference for [taxonomies and their terms](https://codex.wordpress.org/Taxonomies).

**EXAMPLES**

# Create a new term.
Expand Down Expand Up @@ -738,6 +767,8 @@ Manages users, along with their roles, capabilities, and meta.
wp user
~~~

See references for [Roles and Capabilities](https://codex.wordpress.org/Roles_and_Capabilities) and [WP User class](https://codex.wordpress.org/Class_Reference/WP_User).

**EXAMPLES**

# List user IDs
Expand Down
8 changes: 6 additions & 2 deletions features/bootstrap/FeatureContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -699,11 +699,15 @@ public function get_php_binary() {
return 'php';
}

public function start_php_server() {
public function start_php_server( $subdir = '' ) {
$dir = $this->variables['RUN_DIR'] . '/';
if ( $subdir ) {
$dir .= trim( $subdir, '/' ) . '/';
}
$cmd = Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
$this->get_php_binary(),
'localhost:8080',
$this->variables['RUN_DIR'] . '/wordpress/',
$dir,
get_cfg_var( 'cfg_file_path' ),
$this->variables['RUN_DIR'] . '/vendor/wp-cli/server-command/router.php'
);
Expand Down
22 changes: 12 additions & 10 deletions features/bootstrap/Process.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,17 @@ public function run() {
self::$run_times[ $this->command ][1]++;
}

return new ProcessRun( array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
) );
return new ProcessRun(
array(
'stdout' => $stdout,
'stderr' => $stderr,
'return_code' => $return_code,
'command' => $this->command,
'cwd' => $this->cwd,
'env' => $this->env,
'run_time' => $run_time,
)
);
}

/**
Expand All @@ -107,7 +109,7 @@ public function run_check() {
$r = $this->run();

// $r->STDERR is incorrect, but kept incorrect for backwards-compat
if ( $r->return_code || !empty( $r->STDERR ) ) {
if ( $r->return_code || ! empty( $r->STDERR ) ) {
throw new \RuntimeException( $r );
}

Expand Down
Loading

0 comments on commit 50f907c

Please sign in to comment.