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
9 changes: 8 additions & 1 deletion features/comment-recount.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ Feature: Recount comments on a post
3
"""

When I run `wp eval 'global $wpdb; $wpdb->update( $wpdb->posts, array( "comment_count" => 1 ), array( "ID" => 1 ) ); clean_post_cache( 1 );'`
Given a recount-comments.php file:
"""
<?php
global $wpdb;
$wpdb->update( $wpdb->posts, array( "comment_count" => 1 ), array( "ID" => 1 ) );
clean_post_cache( 1 );
"""
When I run `wp eval-file recount-comments.php`
And I run `wp post get 1 --field=comment_count`
Then STDOUT should be:
"""
Expand Down
3 changes: 3 additions & 0 deletions features/comment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ Feature: Manage WordPress comments
"""
And the return code should be 0

@skip-windows
Scenario: Approving/unapproving comments with multidigit comment ID
Given I run `wp comment delete $(wp comment list --field=ID)`
And I run `wp comment generate --count=10 --quiet`
Expand Down Expand Up @@ -343,6 +344,7 @@ Feature: Manage WordPress comments
"""
And the return code should be 0

@skip-windows
Scenario: Spam/unspam comments with multidigit comment ID
Given I run `wp comment delete $(wp comment list --field=ID)`
And I run `wp comment generate --count=10 --quiet`
Expand Down Expand Up @@ -392,6 +394,7 @@ Feature: Manage WordPress comments
"""
And the return code should be 0

@skip-windows
Scenario: Trash/untrash comments with multidigit comment ID
Given I run `wp comment delete $(wp comment list --field=ID) --force`
And I run `wp comment generate --count=10 --quiet`
Expand Down
172 changes: 86 additions & 86 deletions features/post-block.feature

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions features/site.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Feature: Manage sites in a multisite installation
http://first.example.com
"""

@skip-windows
Scenario: Delete a site by id
Given a WP multisite subdirectory install

Expand Down Expand Up @@ -77,6 +78,7 @@ Feature: Manage sites in a multisite installation
When I try the previous command again
Then the return code should be 1

@skip-windows
Scenario: Filter site list
Given a WP multisite install

Expand Down Expand Up @@ -212,6 +214,7 @@ Feature: Manage sites in a multisite installation
"""
And the return code should be 1

@skip-windows
Scenario: Get site info
Given a WP multisite install

Expand Down
9 changes: 8 additions & 1 deletion features/term-recount.feature
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@ Feature: Recount terms on a taxonomy
"""
1
"""
When I run `wp eval 'global $wpdb; $wpdb->update( $wpdb->term_taxonomy, array( "count" => 3 ), array( "term_id" => {TERM_ID} ) ); clean_term_cache( {TERM_ID}, "category" );'`
Given a recount-terms.php file:
"""
<?php
global $wpdb;
$wpdb->update( $wpdb->term_taxonomy, array( "count" => 3 ), array( "term_id" => {TERM_ID} ) );
clean_term_cache( {TERM_ID}, "category" );
"""
When I run `wp eval-file recount-terms.php`
And I run `wp term get category {TERM_ID} --field=count`
Then STDOUT should be:
"""
Expand Down
2 changes: 1 addition & 1 deletion features/term.feature
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Feature: Manage WordPress terms
My\Term\Description
"""

When I run `wp term update category {TERM_ID} --name='My\New\Term' --description='var isEmailValid = /^\S+@\S+.\S+$/.test(email);'`
When I run `wp term update category {TERM_ID} --name="My\New\Term" --description="var isEmailValid = /^\S+@\S+.\S+$/.test(email);"`
Then STDOUT should not be empty

When I run `wp term get category {TERM_ID} --field=name`
Expand Down
18 changes: 14 additions & 4 deletions features/user-application-password.feature
Original file line number Diff line number Diff line change
Expand Up @@ -271,10 +271,15 @@ Feature: Manage user custom fields
When I run `wp user application-password list {USER_ID} --name=someapp --field=uuid`
Then save STDOUT as {UUID}

When I run `wp user application-password get {USER_ID} {UUID} --field=password | sed 's/\$/\\\$/g'`
When I run `wp user application-password get {USER_ID} {UUID} --field=password`
Then save STDOUT as {HASH}

When I run `wp eval "var_export( wp_check_password( '{PASSWORD}', '{HASH}', {USER_ID} ) );"`
Given a check-password.php file:
"""
<?php
var_export( wp_check_password( '{PASSWORD}', '{HASH}', {USER_ID} ) );
"""
When I run `wp eval-file check-password.php`
Then STDOUT should contain:
"""
true
Expand All @@ -297,10 +302,15 @@ Feature: Manage user custom fields
When I run `wp user application-password list {USER_ID} --name=someapp --field=uuid`
Then save STDOUT as {UUID}

When I run `wp user application-password get {USER_ID} {UUID} --field=password | sed 's/\$/\\\$/g'`
When I run `wp user application-password get {USER_ID} {UUID} --field=password`
Then save STDOUT as {HASH}

When I run `wp eval "var_export( wp_verify_fast_hash( '{PASSWORD}', '{HASH}', {USER_ID} ) );"`
Given a verify-fast-hash.php file:
"""
<?php
var_export( wp_verify_fast_hash( '{PASSWORD}', '{HASH}', {USER_ID} ) );
"""
When I run `wp eval-file verify-fast-hash.php`
Then STDOUT should contain:
"""
true
Expand Down
1 change: 1 addition & 0 deletions features/user-import-csv.feature
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ Feature: Import users from CSV
}
"""

@skip-windows
Scenario: Import users from a CSV file generated by `wp user list`
Given a WP install

Expand Down
3 changes: 2 additions & 1 deletion src/Site_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ public function empty_( $args, $assoc_args ) {
foreach ( $files as $fileinfo ) {
$realpath = $fileinfo->getRealPath();
// Don't clobber subsites when operating on the main site
if ( $is_main_site && false !== stripos( $realpath, '/sites/' ) ) {
$normalized_realpath = str_replace( '\\', '/', $realpath );
if ( $is_main_site && false !== stripos( $normalized_realpath, '/sites/' ) ) {
continue;
}
if ( $fileinfo->isDir() ) {
Expand Down
Loading