mirror of
https://gh.wpcy.net/https://github.com/wp-cli/entity-command.git
synced 2026-05-03 02:40:30 +08:00
62 lines
1.7 KiB
Gherkin
62 lines
1.7 KiB
Gherkin
Feature: Generate new WordPress posts
|
|
|
|
Background:
|
|
Given a WP install
|
|
|
|
Scenario: Generating posts
|
|
When I run `echo "Content generated by wp post generate" | wp post generate --count=1 --post_content`
|
|
And I run `wp post list --field=post_content`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Content generated by wp post generate
|
|
"""
|
|
And STDERR should be empty
|
|
|
|
Scenario: Generating posts by a specific author
|
|
|
|
When I run `wp user create dummyuser dummy@example.com --porcelain`
|
|
Then save STDOUT as {AUTHOR_ID}
|
|
|
|
When I run `wp post generate --post_author={AUTHOR_ID} --post_type=post --count=16`
|
|
And I run `wp post list --post_type=post --author={AUTHOR_ID} --format=count`
|
|
Then STDOUT should contain:
|
|
"""
|
|
16
|
|
"""
|
|
|
|
Scenario: Generating pages
|
|
When I run `wp post generate --post_type=page --max_depth=10`
|
|
And I run `wp post list --post_type=page --field=post_parent`
|
|
Then STDOUT should contain:
|
|
"""
|
|
1
|
|
"""
|
|
|
|
Scenario: Generating posts and outputting ids
|
|
When I run `wp post generate --count=1 --format=ids`
|
|
Then save STDOUT as {POST_ID}
|
|
|
|
When I run `wp post update {POST_ID} --post_title="foo"`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
Scenario: Generating post and outputting title and name
|
|
When I run `wp post generate --count=3 --post_title=Howdy!`
|
|
And I run `wp post list --field=post_title --posts_per_page=3`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Howdy!
|
|
Howdy! 2
|
|
Howdy! 3
|
|
"""
|
|
And STDERR should be empty
|
|
And I run `wp post list --field=post_name --posts_per_page=3`
|
|
Then STDOUT should contain:
|
|
"""
|
|
howdy
|
|
howdy-2
|
|
howdy-3
|
|
"""
|
|
And STDERR should be empty
|