Skip to content

Commit

Permalink
Merge pull request #216 from wp-cli/fix/use-https-example-com
Browse files Browse the repository at this point in the history
Adapt feature test to use HTTPS with example.com
  • Loading branch information
schlessera authored Dec 13, 2021
2 parents 7754641 + 894295b commit de3edde
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 35 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ for more details on the `OPTIMIZE TABLE` statement.
Displays the database table prefix.

~~~
wp db prefix
wp db prefix
~~~

Display the database table prefix, as defined by the database handler's interpretation of the current site.
Expand Down Expand Up @@ -631,13 +631,13 @@ They can be concatenated. For instance, the default match color of black on a mu
wp_options:option_value
1:http://wordpress-develop.dev
wp_options:option_value
1:http://example.com/foo
1:https://example.com/foo
...

# Search through a multisite database on the subsite 'foo' for the 'example.com' string
$ wp db search example.com --url=example.com/foo
wp_2_comments:comment_author_url
1:http://example.com/
1:https://example.com/
wp_2_options:option_value
...

Expand Down
61 changes: 31 additions & 30 deletions features/db-search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand All @@ -44,7 +44,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand Down Expand Up @@ -279,6 +279,7 @@ Feature: Search through the database
"""
And the return code should be 0

@require-wp-4.0
Scenario: Search on a multisite install
Given a WP multisite install
And I run `wp site create --slug=foo`
Expand Down Expand Up @@ -312,7 +313,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand All @@ -336,7 +337,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand Down Expand Up @@ -364,7 +365,7 @@ Feature: Search through the database
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should not contain:
"""
Expand All @@ -384,12 +385,12 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should not contain:
"""
Expand All @@ -409,7 +410,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand All @@ -433,12 +434,12 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should contain:
"""
Expand All @@ -460,7 +461,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand Down Expand Up @@ -488,7 +489,7 @@ Feature: Search through the database
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should not contain:
"""
Expand All @@ -509,12 +510,12 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should contain:
"""
Expand All @@ -537,12 +538,12 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should contain:
"""
wp_2_options:option_value
1:http://example.com/foo
1:https://example.com/foo
"""
And STDOUT should contain:
"""
Expand Down Expand Up @@ -712,7 +713,7 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
"""
And STDOUT should not contain:
"""
Expand Down Expand Up @@ -868,31 +869,31 @@ Feature: Search through the database
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
1:https://example.com
wp_options:option_value
2:http://example.com
2:https://example.com
"""

When I run `wp db search example.com --table_column_once`
Then STDOUT should contain:
"""
wp_options:option_value
1:http://example.com
2:http://example.com
1:https://example.com
2:https://example.com
"""

When I run `wp db search example.com --one_line`
Then STDOUT should contain:
"""
wp_options:option_value:1:http://example.com
wp_options:option_value:2:http://example.com
wp_options:option_value:1:https://example.com
wp_options:option_value:2:https://example.com
"""

When I run `wp db search example.com --table_column_once --one_line`
Then STDOUT should contain:
"""
wp_options:option_value:1:http://example.com
wp_options:option_value:2:http://example.com
wp_options:option_value:1:https://example.com
wp_options:option_value:2:https://example.com
"""

When I run `wp db search example.com --all-tables --before_context=0 --after_context=0 --matches_only`
Expand Down Expand Up @@ -920,35 +921,35 @@ Feature: Search through the database
Then STDOUT should strictly contain:
"""
wp_options:option_value
[33;1m1[0m:http://[43m[30mexample.com[0m
[33;1m1[0m:https://[43m[30mexample.com[0m
"""

When I run `SHELL_PIPE=0 wp db search example.com --table_column_color=%r --id_color=%g --match_color=%b`
Then STDOUT should strictly contain:
"""
wp_options:option_value
[32m1[0m:http://[34mexample.com[0m
[32m1[0m:https://[34mexample.com[0m
"""

When I run `SHELL_PIPE=0 wp db search example.com --table_column_color=%r`
Then STDOUT should strictly contain:
"""
wp_options:option_value
[33;1m1[0m:http://[43m[30mexample.com[0m
[33;1m1[0m:https://[43m[30mexample.com[0m
"""

When I run `SHELL_PIPE=0 wp db search example.com --id_color=%g`
Then STDOUT should strictly contain:
"""
wp_options:option_value
[32m1[0m:http://[43m[30mexample.com[0m
[32m1[0m:https://[43m[30mexample.com[0m
"""

When I run `SHELL_PIPE=0 wp db search example.com --match_color=%b`
Then STDOUT should strictly contain:
"""
wp_options:option_value
[33;1m1[0m:http://[34mexample.com[0m
[33;1m1[0m:https://[34mexample.com[0m
"""

When I run `SHELL_PIPE=0 wp db search example.com --before_context=0 --after_context=0`
Expand Down
4 changes: 2 additions & 2 deletions src/DB_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -1223,13 +1223,13 @@ public function prefix() {
* wp_options:option_value
* 1:http://wordpress-develop.dev
* wp_options:option_value
* 1:http://example.com/foo
* 1:https://example.com/foo
* ...
*
* # Search through a multisite database on the subsite 'foo' for the 'example.com' string
* $ wp db search example.com --url=example.com/foo
* wp_2_comments:comment_author_url
* 1:http://example.com/
* 1:https://example.com/
* wp_2_options:option_value
* ...
*
Expand Down

0 comments on commit de3edde

Please sign in to comment.