Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test case for publishing post and updating date behavior #428

Merged
merged 1 commit into from
Oct 13, 2023
Merged
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
36 changes: 36 additions & 0 deletions features/post.feature
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,39 @@ Feature: Manage WordPress posts
"""
0
"""

Scenario: Publishing a post and setting a date fails if the edit_date flag is not passed.
Given a WP install

When I run `wp post create --post_title='test' --porcelain`
Then save STDOUT as {POST_ID}

When I run `wp post update {POST_ID} --post_date='2005-01-24T09:52:00.000Z' --post_status='publish'`
Then STDOUT should contain:
"""
Success:
"""

When I run `wp post get {POST_ID} --field=post_date`
Then STDOUT should not contain:
"""
2005-01-24 09:52:00
"""

Scenario: Publishing a post and setting a date succeeds if the edit_date flag is passed.
Given a WP install

When I run `wp post create --post_title='test' --porcelain`
Then save STDOUT as {POST_ID}

When I run `wp post update {POST_ID} --post_date='2005-01-24T09:52:00.000Z' --post_status='publish' --edit_date=1`
Then STDOUT should contain:
"""
Success:
"""

When I run `wp post get {POST_ID} --field=post_date`
Then STDOUT should contain:
"""
2005-01-24 09:52:00
"""