Add support for --post_date_gmt in post generate#184
Add support for --post_date_gmt in post generate#184schlessera merged 4 commits intowp-cli:masterfrom
--post_date_gmt in post generate#184Conversation
|
Needs Tests |
|
@jblz Thanks for the pull request. Are you up for providing the tests as well? |
@schlessera Happy to, but would love a pointer on where / how to add them. I'm not seeing anything related here for example and you can probably point me in the right direction more quickly than I can figure it out on my own :) |
|
@jblz The tests are done as functional tests in Behat. You can find the current tests for You can find an overview of how to work on tests in WP-CLI here: https://make.wordpress.org/cli/handbook/pull-requests/#running-and-writing-tests |
|
@jblz Are you still up for working on the tests? Do you need further help with that? |
Set the GMT date of the generated posts. Default: value of post_date (or current date if it's not set)
|
@schlessera Thanks for the nudge (& for the instructions on getting set up w/ behat). I managed to get my test env set up & make this actually work :) I think it's ready for review if the CI comes back green. |
features/post-generate.feature
Outdated
| """ | ||
|
|
||
| Scenario: Generating posts with post_date argument with time | ||
| When I run `wp post generate --count=1 --post_date="2018-07-02 00:00:00"` |
There was a problem hiding this comment.
You should use a different time here, otherwise you cannot tell whether the time was accepted as an argument or whether the default is being used.
features/post-generate.feature
Outdated
| """ | ||
|
|
||
| Scenario: Generating posts with post_date_gmt argument with time | ||
| When I run `wp post generate --count=1 --post_date_gmt="2018-07-04 00:00:00"` |
There was a problem hiding this comment.
Same as with the post_date example, you should use a different time here, otherwise you cannot tell whether the time was accepted as an argument or whether the default is being used.
|
@jblz I'm glad to hear that! The tests look good apart from a minor nitpick with the time in two of them. And as far as I can tell, they already uncovered a bug that you needed to fix to make the tests pass, right? So it was definitely not a waste of time to write the tests. As soon as you have done the requested changes, this will be good to be merged. |
Yep! I needed to pull the
It rarely is! Requested changes are in place. |
|
Thanks for the pull-request, @jblz ! |
--post_date_gmt in post generate
Sets the GMT / UTC date of the generated posts.
If the
--post_date_gmtflag is provided, use that.If not, default to the value of post_date (which defaults to the current date if it's not set).
Fixes #183