mirror of
https://gh.wpcy.net/https://github.com/wp-cli/entity-command.git
synced 2026-05-02 05:25:00 +08:00
44 lines
1.2 KiB
Gherkin
44 lines
1.2 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:
|
|
"""
|
|
|