| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -33,6 +33,32 @@ Feature: List WordPress options | |||
| 33 | 33 | siteurl | |
| 34 | 34 | """ | |
| 35 | 35 | ||
| 36 | + @skip-object-cache | ||
| 37 | + Scenario: Using the `--autoload=on` flag excludes transients by default | ||
| 38 | + Given a WP install | ||
| 39 | + And I run `wp option add sample_autoload_option 'sample_autoload_option' --autoload=yes` | ||
| 40 | + And I run `wp transient set sample_autoload_transient 'sample_autoload_transient'` | ||
| 41 | + | ||
| 42 | + When I run `wp option list --autoload=on` | ||
| 43 | + Then STDOUT should contain: | ||
| 44 | + """ | ||
| 45 | + sample_autoload_option | ||
| 46 | + """ | ||
| 47 | + And STDOUT should not contain: | ||
| 48 | + """ | ||
| 49 | + sample_autoload_transient | ||
| 50 | + """ | ||
| 51 | + | ||
| 52 | + When I run `wp option list --transients --autoload=on` | ||
| 53 | + Then STDOUT should contain: | ||
| 54 | + """ | ||
| 55 | + sample_autoload_transient | ||
| 56 | + """ | ||
| 57 | + And STDOUT should not contain: | ||
| 58 | + """ | ||
| 59 | + sample_autoload_option | ||
| 60 | + """ | ||
| 61 | + | ||
| 36 | 62 | Scenario: List option with exclude pattern | |
| 37 | 63 | Given a WP install | |
| 38 | 64 | ||
@@ -198,4 +224,4 @@ Feature: List WordPress options | |||
| 198 | 224 | And STDOUT should contain: | |
| 199 | 225 | """ | |
| 200 | 226 | sample_value_four | |
| 201 | - """ | ||
| 227 | + """ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -294,9 +294,9 @@ public function list_( $args, $assoc_args ) { | |||
| 294 | 294 | if ( isset( $assoc_args['autoload'] ) ) { | |
| 295 | 295 | $autoload = $assoc_args['autoload']; | |
| 296 | 296 | if ( 'on' === $autoload || 'yes' === $autoload ) { | |
| 297 | - $autoload_query = " AND (autoload='on') OR (autoload='yes')"; | ||
| 297 | + $autoload_query = " AND (autoload='on' OR autoload='yes')"; | ||
| 298 | 298 | } elseif ( 'off' === $autoload || 'no' === $autoload ) { | |
| 299 | - $autoload_query = " AND (autoload='off') OR (autoload='no')"; | ||
| 299 | + $autoload_query = " AND (autoload='off' OR autoload='no')"; | ||
| 300 | 300 | } else { | |
| 301 | 301 | WP_CLI::error( "Value of '--autoload' should be 'on', 'off', 'yes', or 'no'." ); | |
| 302 | 302 | } | |
@@ -306,11 +306,11 @@ public function list_( $args, $assoc_args ) { | |||
| 306 | 306 | $show_transients = Utils\get_flag_value( $assoc_args, 'transients', false ); | |
| 307 | 307 | ||
| 308 | 308 | if ( $show_transients ) { | |
| 309 | - $transients_query = " AND option_name LIKE '\_transient\_%' | ||
| 310 | - OR option_name LIKE '\_site\_transient\_%'"; | ||
| 309 | + $transients_query = " AND (option_name LIKE '\_transient\_%' | ||
| 310 | + OR option_name LIKE '\_site\_transient\_%')"; | ||
| 311 | 311 | } else { | |
| 312 | - $transients_query = " AND option_name NOT LIKE '\_transient\_%' | ||
| 313 | - AND option_name NOT LIKE '\_site\_transient\_%'"; | ||
| 312 | + $transients_query = " AND (option_name NOT LIKE '\_transient\_%' | ||
| 313 | + AND option_name NOT LIKE '\_site\_transient\_%')"; | ||
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | 316 | $where = ''; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments