From: scribu Date: Sat, 18 May 2013 16:04:42 +0000 (+0300) Subject: option: add tests X-Git-Tag: v0.10.0~49^2~9 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=51186ddd9c75347b452e2be176866bbbaf80263d;p=wvm%2Fwvm.git option: add tests --- diff --git a/features/option.feature b/features/option.feature new file mode 100644 index 00000000..0ab33e81 --- /dev/null +++ b/features/option.feature @@ -0,0 +1,28 @@ +Feature: Manage WordPress options + + Scenario: Option CRUD + Given a WP install + + When I run `wp option add foo 'bar'` + Then STDOUT should be empty + + When I run `wp option get foo` + Then STDOUT should be: + """ + bar + """ + + When I run `wp option set foo '[ 1, 2 ]' --format=json` + Then STDOUT should be empty + + When I run `wp option get foo --format=json` + Then STDOUT should be: + """ + [1,2] + """ + + When I run `wp option delete foo` + Then STDOUT should be empty + + When I try `wp option get foo` + Then the return code should be 1 diff --git a/php/commands/option.php b/php/commands/option.php index 525a89a3..361a1f73 100644 --- a/php/commands/option.php +++ b/php/commands/option.php @@ -10,7 +10,7 @@ class Option_Command extends WP_CLI_Command { /** * Get an option. * - * @synopsis [--json] + * @synopsis [--format=] */ public function get( $args, $assoc_args ) { list( $key ) = $args; @@ -26,7 +26,7 @@ class Option_Command extends WP_CLI_Command { /** * Add an option. * - * @synopsis [--json] + * @synopsis [--format=] */ public function add( $args, $assoc_args ) { $key = $args[0]; @@ -42,7 +42,7 @@ class Option_Command extends WP_CLI_Command { * Update an option. * * @alias set - * @synopsis [--json] + * @synopsis [--format=] */ public function update( $args, $assoc_args ) { $key = $args[0];