File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,19 @@ Feature: `wp cli` tasks
4141 And STDERR should be empty
4242 And the return code should be 0
4343
44+ Scenario : Dump the list of global parameters in plaintext format
45+ Given a WP installation
46+
47+ # `plaintext` is an accepted alias of `var_export` for this command (see #4774),
48+ # so it must emit the var_export representation, not JSON.
49+ When I run `wp cli param-dump --format=plaintext`
50+ Then STDOUT should contain:
51+ """
52+ 'path' =>
53+ """
54+ And STDERR should be empty
55+ And the return code should be 0
56+
4457 Scenario : Checking whether a global configuration parameter exists or not
4558 Given a WP installation
4659 And a custom-cmd.php file:
Original file line number Diff line number Diff line change @@ -993,6 +993,7 @@ private function array_find( $arr, $callback ) {
993993 * default: json
994994 * options:
995995 * - var_export
996+ * - plaintext
996997 * - json
997998 * ---
998999 *
@@ -1034,7 +1035,11 @@ public function param_dump( $_, $assoc_args ) {
10341035 }
10351036 }
10361037
1037- if ( 'var_export ' === Utils \get_flag_value ( $ assoc_args , 'format ' ) ) {
1038+ // `plaintext` and `var_export` are the same format under two names; accept both
1039+ // so the format name is consistent with other commands. See
1040+ // https://github.com/wp-cli/wp-cli/issues/4774
1041+ $ format = Utils \get_flag_value ( $ assoc_args , 'format ' );
1042+ if ( 'var_export ' === $ format || 'plaintext ' === $ format ) {
10381043 var_export ( $ spec );
10391044 } else {
10401045 echo json_encode ( $ spec );
You can’t perform that action at this time.
0 commit comments