Skip to content
Merged
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
8 changes: 8 additions & 0 deletions features/post-generate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Feature: Generate new WordPress posts
"""
And STDERR should be empty

@broken
Scenario: Using --post-content requires STDIN input
When I try `wp post generate --count=1 --post_content`
Then STDERR should contain:
"""
Error: The parameter `post_content` reads from STDIN.
"""

Scenario: Generating posts by a specific author

When I run `wp user create dummyuser dummy@example.com --porcelain`
Expand Down
4 changes: 4 additions & 0 deletions src/Post_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,10 @@ public function generate( $args, $assoc_args ) {
}

if ( \WP_CLI\Utils\get_flag_value( $assoc_args, 'post_content' ) ) {
if ( ! \WP_CLI\Entity\Utils::has_stdin() ) {
WP_CLI::error( 'The parameter `post_content` reads from STDIN.' );
}

$post_content = file_get_contents( 'php://stdin' );
}

Expand Down