Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"wp-cli/extension-command": "^1.2 || ^2 || ^3",
"wp-cli/media-command": "^1.1 || ^2 || ^3",
"wp-cli/super-admin-command": "^1 || ^2 || ^3",
"wp-cli/wp-cli-tests": "^5"
"wp-cli/wp-cli-tests": "dev-setup-commands-step as 5.3.99"
},
"config": {
"process-timeout": 7200,
Expand Down
8 changes: 5 additions & 3 deletions features/comment-recount.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ Feature: Recount comments on a post
Scenario: Recount comments on a post
Given a WP install

When I run `wp comment create --comment_post_ID=1 --comment_approved=1 --porcelain`
And I run `wp comment create --comment_post_ID=1 --comment_approved=1 --porcelain`
And I run `wp post get 1 --field=comment_count`
Given these setup commands:
| command |
| wp comment create --comment_post_ID=1 --comment_approved=1 --porcelain |
| wp comment create --comment_post_ID=1 --comment_approved=1 --porcelain |
When I run `wp post get 1 --field=comment_count`
Then STDOUT should be:
"""
3
Expand Down
8 changes: 5 additions & 3 deletions features/comment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ Feature: Manage WordPress comments
"""
And the return code should be 1

When I run `wp comment create --comment_post_ID=1`
And I run `wp comment create --comment_post_ID=1`
And I run `wp comment delete 3 4`
Given these setup commands:
| command |
| wp comment create --comment_post_ID=1 |
| wp comment create --comment_post_ID=1 |
When I run `wp comment delete 3 4`
Then STDOUT should be:
"""
Success: Trashed comment 3.
Expand Down
8 changes: 5 additions & 3 deletions features/menu-location.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ Feature: Manage WordPress menu locations
| location | description |
| primary | Primary Menu |

When I run `wp menu create "Primary Menu"`
And I run `wp menu location assign primary-menu primary`
And I run `wp menu list --fields=slug,locations`
Given these setup commands:
| command |
| wp menu create "Primary Menu" |
| wp menu location assign primary-menu primary |
When I run `wp menu list --fields=slug,locations`
Then STDOUT should be a table containing rows:
| slug | locations |
| primary-menu | primary |
Expand Down
8 changes: 5 additions & 3 deletions features/menu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ Feature: Manage WordPress menus
0
"""

When I run `wp menu create "First Menu"`
And I run `wp menu create "Second Menu"`
And I run `wp menu list --fields=name,slug`
Given these setup commands:
| command |
| wp menu create "First Menu" |
| wp menu create "Second Menu" |
When I run `wp menu list --fields=name,slug`
Then STDOUT should be a table containing rows:
| name | slug |
| First Menu | first-menu |
Expand Down
40 changes: 25 additions & 15 deletions features/option-list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ Feature: List WordPress options
@skip-object-cache
Scenario: Using the `--autoload=on` flag excludes transients by default
Given a WP install
And I run `wp option add sample_autoload_option 'sample_autoload_option' --autoload=yes`
And I run `wp transient set sample_autoload_transient 'sample_autoload_transient'`
And these setup commands:
| command |
| wp option add sample_autoload_option 'sample_autoload_option' --autoload=yes |
| wp transient set sample_autoload_transient 'sample_autoload_transient' |

When I run `wp option list --autoload=on`
Then STDOUT should contain:
Expand All @@ -62,9 +64,11 @@ Feature: List WordPress options
Scenario: List option with exclude pattern
Given a WP install

When I run `wp option add sample_test_field_one sample_test_field_value_one`
And I run `wp option add sample_test_field_two sample_test_field_value_two`
And I run `wp option list --search="sample_test_field_*" --format=csv`
Given these setup commands:
| command |
| wp option add sample_test_field_one sample_test_field_value_one |
| wp option add sample_test_field_two sample_test_field_value_two |
When I run `wp option list --search="sample_test_field_*" --format=csv`
Then STDOUT should be:
"""
option_name,option_value
Expand Down Expand Up @@ -93,8 +97,10 @@ Feature: List WordPress options

Scenario: List option with sorting option
Given a WP install
And I run `wp option add sample_test_field_one sample_test_field_value_one`
And I run `wp option add sample_test_field_two sample_test_field_value_two`
And these setup commands:
| command |
| wp option add sample_test_field_one sample_test_field_value_one |
| wp option add sample_test_field_two sample_test_field_value_two |

When I run `wp option list --search="sample_test_field_*" --format=csv --orderby=option_id --order=asc`
Then STDOUT should be:
Expand Down Expand Up @@ -178,10 +184,12 @@ Feature: List WordPress options

Scenario: Using the `--autoload=on` flag
Given a WP install
And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
And these setup commands:
| command |
| wp option add sample_autoload_one 'sample_value_one' --autoload=yes |
| wp option add sample_autoload_two 'sample_value_two' --autoload=no |
| wp option add sample_autoload_three 'sample_value_three' --autoload=on |
| wp option add sample_autoload_four 'sample_value_four' --autoload=off |

When I run `wp option list --autoload=on`
Then STDOUT should not contain:
Expand All @@ -203,10 +211,12 @@ Feature: List WordPress options

Scenario: Using the `--autoload=off` flag
Given a WP install
And I run `wp option add sample_autoload_one 'sample_value_one' --autoload=yes`
And I run `wp option add sample_autoload_two 'sample_value_two' --autoload=no`
And I run `wp option add sample_autoload_three 'sample_value_three' --autoload=on`
And I run `wp option add sample_autoload_four 'sample_value_four' --autoload=off`
And these setup commands:
| command |
| wp option add sample_autoload_one 'sample_value_one' --autoload=yes |
| wp option add sample_autoload_two 'sample_value_two' --autoload=no |
| wp option add sample_autoload_three 'sample_value_three' --autoload=on |
| wp option add sample_autoload_four 'sample_value_four' --autoload=off |

When I run `wp option list --autoload=off`
Then STDOUT should not contain:
Expand Down
36 changes: 20 additions & 16 deletions features/post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,11 @@ Feature: Manage WordPress posts
| Sample Page | sample-page | publish |

Scenario: List posts with date query
When I run `wp post create --post_title='old post' --post_date='2023-01-24T09:52:00.000Z'`
And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z'`
And I run `wp post list --field=post_title --date_query='{"before":{"year":"2024"}}'`
Given these setup commands:
| command |
| wp post create --post_title='old post' --post_date='2023-01-24T09:52:00.000Z' |
| wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z' |
When I run `wp post list --field=post_title --date_query='{"before":{"year":"2024"}}'`
Then STDOUT should contain:
"""
old post
Expand All @@ -407,12 +409,14 @@ Feature: Manage WordPress posts
"""

Scenario: List posts with tax query
When I run `wp term create category "First Category" --porcelain`
And I run `wp term create category "Second Category" --porcelain`
And I run `wp post create --post_title='post-1' --post_category="First Category"`
And I run `wp post create --post_title='post-2' --post_category="Second Category"`
And I run `wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z'`
And I run `wp post list --field=post_title --tax_query='[{"taxonomy":"category","field":"slug","terms":"first-category"}]'`
Given these setup commands:
| command |
| wp term create category "First Category" --porcelain |
| wp term create category "Second Category" --porcelain |
| wp post create --post_title='post-1' --post_category="First Category" |
| wp post create --post_title='post-2' --post_category="Second Category" |
| wp post create --post_title='new post' --post_date='2025-01-24T09:52:00.000Z' |
When I run `wp post list --field=post_title --tax_query='[{"taxonomy":"category","field":"slug","terms":"first-category"}]'`
Then STDOUT should contain:
"""
post-1
Expand All @@ -423,13 +427,13 @@ Feature: Manage WordPress posts
"""

Scenario: Creating/updating posts with taxonomies
When I run `wp term create category "First Category" --porcelain`
And save STDOUT as {CAT_1}
And I run `wp term create category "Second Category" --porcelain`
And save STDOUT as {CAT_2}
And I run `wp term create post_tag "Term One" --porcelain`
And I run `wp term create post_tag "Term Two" --porcelain`
And I run `wp post create --post_title='Test Post' --post_content='Test post content' --tax_input='{"category":[{CAT_1},{CAT_2}],"post_tag":["term-one", "term-two"]}' --porcelain`
Given these setup commands:
| command | save |
| wp term create category "First Category" --porcelain | CAT_1 |
| wp term create category "Second Category" --porcelain | CAT_2 |
| wp term create post_tag "Term One" --porcelain | |
| wp term create post_tag "Term Two" --porcelain | |
When I run `wp post create --post_title='Test Post' --post_content='Test post content' --tax_input='{"category":[{CAT_1},{CAT_2}],"post_tag":["term-one", "term-two"]}' --porcelain`
Then STDOUT should be a number
And save STDOUT as {POST_ID}

Expand Down
44 changes: 28 additions & 16 deletions features/signup.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ Feature: Manage signups in a multisite installation

Scenario: List signups
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );"`
And I run `wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );" |
| wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );" |

When I run `wp user signup list --fields=signup_id,user_login,user_email,active --format=csv`
Then STDOUT should be:
Expand Down Expand Up @@ -101,8 +103,10 @@ Feature: Manage signups in a multisite installation

Scenario: Activate multiple signups
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );"`
And I run `wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );" |
| wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );" |

When I run `wp user signup list --active=0 --format=count`
Then STDOUT should be:
Expand Down Expand Up @@ -147,8 +151,10 @@ Feature: Manage signups in a multisite installation

Scenario: Delete signups
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );"`
And I run `wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );" |
| wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );" |

When I run `wp user signup get bobuser --field=user_email`
Then STDOUT should be:
Expand Down Expand Up @@ -176,8 +182,10 @@ Feature: Manage signups in a multisite installation

Scenario: Delete all signups
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );"`
And I run `wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'bobuser', 'bobuser@example.com' );" |
| wp eval "wpmu_signup_user( 'johnuser', 'johnuser@example.com' );" |

When I try `wp user signup delete`
Then STDERR should be:
Expand All @@ -199,10 +207,12 @@ Feature: Manage signups in a multisite installation

Scenario: Expose add_to_blog, new_role, and blog_id fields and support filtering by them
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'adminuser', 'adminuser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'administrator' ) );"`
And I run `wp eval "wpmu_signup_user( 'editoruser', 'editoruser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'editor' ) );"`
And I run `wp eval "wpmu_signup_user( 'otherbloguser', 'otherbloguser@example.com', array( 'add_to_blog' => 300, 'new_role' => 'administrator' ) );"`
And I run `wp eval "wpmu_signup_user( 'plainuser', 'plainuser@example.com' );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'adminuser', 'adminuser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'administrator' ) );" |
| wp eval "wpmu_signup_user( 'editoruser', 'editoruser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'editor' ) );" |
| wp eval "wpmu_signup_user( 'otherbloguser', 'otherbloguser@example.com', array( 'add_to_blog' => 300, 'new_role' => 'administrator' ) );" |
| wp eval "wpmu_signup_user( 'plainuser', 'plainuser@example.com' );" |

When I run `wp user signup list --active=0 --new_role=administrator --fields=user_login,new_role,blog_id --format=csv`
Then STDOUT should be:
Expand Down Expand Up @@ -248,10 +258,12 @@ Feature: Manage signups in a multisite installation

Scenario: Filter signups by metadata with per_page pagination
Given a WP multisite install
And I run `wp eval "wpmu_signup_user( 'plainuser', 'plainuser@example.com' );"`
And I run `wp eval "wpmu_signup_user( 'adminuser', 'adminuser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'administrator' ) );"`
And I run `wp eval "wpmu_signup_user( 'editoruser', 'editoruser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'editor' ) );"`
And I run `wp eval "wpmu_signup_user( 'otherbloguser', 'otherbloguser@example.com', array( 'add_to_blog' => 300, 'new_role' => 'administrator' ) );"`
And these setup commands:
| command |
| wp eval "wpmu_signup_user( 'plainuser', 'plainuser@example.com' );" |
| wp eval "wpmu_signup_user( 'adminuser', 'adminuser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'administrator' ) );" |
| wp eval "wpmu_signup_user( 'editoruser', 'editoruser@example.com', array( 'add_to_blog' => 228, 'new_role' => 'editor' ) );" |
| wp eval "wpmu_signup_user( 'otherbloguser', 'otherbloguser@example.com', array( 'add_to_blog' => 300, 'new_role' => 'administrator' ) );" |

When I run `wp user signup list --blog_id=228 --per_page=2 --fields=user_login,blog_id --format=csv`
Then STDOUT should be:
Expand Down
12 changes: 7 additions & 5 deletions features/user-application-password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ Feature: Manage user custom fields
When I try `wp user application-password get 1 {UUID}`
Then the return code should be 1

When I run `wp user application-password create 1 myapp1`
And I run `wp user application-password create 1 myapp2`
And I run `wp user application-password create 1 myapp3`
And I run `wp user application-password create 1 myapp4`
And I run `wp user application-password create 1 myapp5`
Given these setup commands:
| command |
| wp user application-password create 1 myapp1 |
| wp user application-password create 1 myapp2 |
| wp user application-password create 1 myapp3 |
| wp user application-password create 1 myapp4 |
When I run `wp user application-password create 1 myapp5`
Then STDOUT should not be empty

When I run `wp user application-password list 1 --format=count`
Expand Down
6 changes: 4 additions & 2 deletions features/user-import-csv.feature
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ Feature: Import users from CSV
Given a WP install

When I run `wp user delete 1 --yes`
And I run `wp user create bobjones bobjones@example.com --display_name="Bob Jones" --role=contributor`
And I run `wp user create billjones billjones@example.com --display_name="Bill Jones" --role=administrator`
And these setup commands:
| command |
| wp user create bobjones bobjones@example.com --display_name="Bob Jones" --role=contributor |
| wp user create billjones billjones@example.com --display_name="Bill Jones" --role=administrator |
And I run `wp user add-role billjones author`
Then STDOUT should not be empty

Expand Down
6 changes: 4 additions & 2 deletions features/user-list.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ Feature: List WordPress users
@require-wp-4.4
Scenario: List users of specific roles
Given a WP install
And I run `wp user create bobjones bob@example.com --role=author`
And I run `wp user create sally sally@example.com --role=editor`
And these setup commands:
| command |
| wp user create bobjones bob@example.com --role=author |
| wp user create sally sally@example.com --role=editor |

When I run `wp user list --field=user_login`
Then STDOUT should be:
Expand Down
8 changes: 5 additions & 3 deletions features/user-meta.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ Feature: Manage user custom meta fields
When I try `wp user meta get 1 foo`
Then the return code should be 1

When I run `wp user meta add 1 foo bar`
And I run `wp user meta add 1 foo bar2`
And I run `wp user meta add 1 foo bar3`
Given these setup commands:
| command |
| wp user meta add 1 foo bar |
| wp user meta add 1 foo bar2 |
When I run `wp user meta add 1 foo bar3`
Then STDOUT should not be empty

When I run `wp user meta delete 1 foo bar2`
Expand Down
12 changes: 7 additions & 5 deletions features/user-session.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ Feature: Manage user session

@require-wp-4.0
Scenario: Destroy user sessions
When I run `wp eval 'wp_set_current_user(1);'`
And I run `wp eval 'wp_set_auth_cookie(1);'`
And I run `wp eval 'wp_set_current_user(1);'`
And I run `wp eval 'wp_set_auth_cookie(1);'`
And I run `wp user session list admin --format=count`
Given these setup commands:
| command |
| wp eval 'wp_set_current_user(1);' |
| wp eval 'wp_set_auth_cookie(1);' |
| wp eval 'wp_set_current_user(1);' |
| wp eval 'wp_set_auth_cookie(1);' |
When I run `wp user session list admin --format=count`
Then STDOUT should be:
"""
2
Expand Down
Loading
Loading