Skip to content

Commit

Permalink
Add test case for publishing post and updating date behavior (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbachhuber authored Oct 13, 2023
1 parent 9b4a1d0 commit 45d4f3a
Showing 1 changed file with 36 additions and 0 deletions.
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
"""

0 comments on commit 45d4f3a

Please sign in to comment.