Skip to content

Commit

Permalink
adapt feature tests to scheme for older WP versions
Browse files Browse the repository at this point in the history
  • Loading branch information
i-am-chitti committed May 4, 2024
1 parent e8a2381 commit 9bd8441
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions features/site-generate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -59,44 +59,49 @@ Feature: Generate new WordPress sites

Scenario: Generate subdirectory sites
Given a WP multisite subdirectory install
When I run `wp site generate --count=1`
Then STDOUT should be empty
And I run `wp site list --site__in=2 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME}

When I run `wp site generate --count=1`
Then STDOUT should be empty

When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | https://example.com/site1/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2
"""
When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | {SCHEME}://example.com/site1/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2
"""

Scenario: Generate sites with a slug
Given a WP multisite subdirectory install
When I run `wp site generate --count=2 --slug=subsite`
Then STDOUT should be empty
Given a WP multisite subdirectory install
When I run `wp site generate --count=2 --slug=subsite`
Then STDOUT should be empty
And I run `wp site list --site__in=2 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME1}
And I run `wp site list --site__in=3 --field=url | sed -e's,^\(.*\)://.*,\1,g'`
And save STDOUT as {SCHEME2}

When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | https://example.com/subsite1/ |
| 3 | https://example.com/subsite2/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2 3
"""
When I run `wp site list --fields=blog_id,url`
Then STDOUT should be a table containing rows:
| blog_id | url |
| 1 | https://example.com/ |
| 2 | {SCHEME1}://example.com/subsite1/ |
| 3 | {SCHEME2}://example.com/subsite2/ |
When I run `wp site list --format=ids`
Then STDOUT should be:
"""
1 2 3
"""

Scenario: Generate sites with reserved slug
Given a WP multisite subdirectory install
When I try `wp site generate --count=2 --slug=page`
Then STDERR should contain:
"""
The following words are reserved and cannot be used as blog names: page, comments, blog, files, feed
"""
And STDOUT should be empty
And the return code should be 1
Given a WP multisite subdirectory install
When I try `wp site generate --count=2 --slug=page`
Then STDERR should contain:
"""
The following words are reserved and cannot be used as blog names: page, comments, blog, files, feed
"""
And STDOUT should be empty
And the return code should be 1

0 comments on commit 9bd8441

Please sign in to comment.