Added support for post_title for command:post generate#94
Added support for post_title for command:post generate#94schlessera merged 6 commits intowp-cli:masterfrom
Conversation
|
As mentioned in issue, it will add new option post_title . It will add post name according to the post_title. |
danielbachhuber
left a comment
There was a problem hiding this comment.
Thanks @emgk ! Can you add functional tests to this pull request, and fix the PHP 5.3 compatibility issue?
|
In my system(Ubuntu 16.04LTS) I am facing this error while running functional test, https://wordpress.slack.com/archives/C02RP4T41/p1506966006000090 |
|
@emgk if you do a |
|
Your problem is wp-cli/wp-cli#4370. Thanks 😊 |
|
Ah, sorry I didn't reload.
Oh, I didn't know that! |
|
@emgk Are you still looking into the functional tests for this PR? |
|
Yes @schlessera as I couldn't found any perfect solution to solve the issue i am fetching https://wordpress.slack.com/archives/C02RP4T41/p1506966006000090 |
|
@emgk Planning to finish this pull request, or would you like help wrapping it up? |
|
i can't create functional tests. |
|
@emgk could you try composer require --dev wp-cli/wp-cli:dev-masterand see if that fixes things for you? |
|
@danielbachhuber I have added the functional test could you please check it? |
|
@emgk Glad to see you got the tests running on your system! As some of the logic is based on the fact that you can generate multiple posts, I'd like to have the test create 3 posts instead of only 1. Also, you should check both the To verify the strings it generated for the title and slug are correct, you can store the count of existing posts with a preliminary command and reuse that count in the tests, like so: Then, you can use |
|
@schlessera I have made changes according as per your comment could you please check? |
features/post-generate.feature
Outdated
| Scenario: Generating post and outputting title and name | ||
| When I run `wp post generate --count=3 --post_title=Howdy!` | ||
| When I run `wp post list --format=count` | ||
| And save STDOUT as {POST_COUNT} |
There was a problem hiding this comment.
This is not exactly how I meant using {POST_COUNT}. I assumed that you would get random IDs attached to the slugs and titles, so you'd use {POST_COUNT} to calculate the IDs that would be generated.
However, it looks like the empty site will always start with the same IDs either way, so that is not needed.
You can remove lines 47 & 48, and just hard-code the --posts_per_page instead.
Sorry for misleading you, I thought we would get more random IDs.
There was a problem hiding this comment.
No problem @schlessera I have hard-coded the number of posts. please check.
|
Thanks for the PR and the perseverance, @emgk ! |
This PR Fixes issue wp-cli/wp-cli#4382
\cc @danielbachhuber @schlessera