Skip to content

Added support for post_title for command:post generate#94

Merged
schlessera merged 6 commits intowp-cli:masterfrom
emgk:issue/4382
Nov 29, 2017
Merged

Added support for post_title for command:post generate#94
schlessera merged 6 commits intowp-cli:masterfrom
emgk:issue/4382

Conversation

@emgk
Copy link
Contributor

@emgk emgk commented Oct 1, 2017

@emgk
Copy link
Contributor Author

emgk commented Oct 1, 2017

As mentioned in issue, it will add new option post_title . It will add post name according to the post_title.

Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @emgk ! Can you add functional tests to this pull request, and fix the PHP 5.3 compatibility issue?

@emgk
Copy link
Contributor Author

emgk commented Oct 2, 2017

In my system(Ubuntu 16.04LTS) I am facing this error while running functional test, https://wordpress.slack.com/archives/C02RP4T41/p1506966006000090

@gitlost
Copy link
Contributor

gitlost commented Oct 2, 2017

@emgk if you do a composer update it should go away (PR wp-cli/wp-cli#4371, issue wp-cli/wp-cli#4370).

@miya0001
Copy link
Member

miya0001 commented Oct 2, 2017

@emgk

Your problem is wp-cli/wp-cli#4370.
Please update your WP-CLI to nightly.

$ wp cli update --nightly

Thanks 😊

@miya0001
Copy link
Member

miya0001 commented Oct 2, 2017

Ah, sorry I didn't reload.

composer update

Oh, I didn't know that!

@schlessera
Copy link
Member

@emgk Are you still looking into the functional tests for this PR?

@emgk
Copy link
Contributor Author

emgk commented Oct 8, 2017

Yes @schlessera as I couldn't found any perfect solution to solve the issue i am fetching https://wordpress.slack.com/archives/C02RP4T41/p1506966006000090

@danielbachhuber
Copy link
Member

@emgk Planning to finish this pull request, or would you like help wrapping it up?

@emgk
Copy link
Contributor Author

emgk commented Oct 25, 2017

i can't create functional tests.

@gitlost
Copy link
Contributor

gitlost commented Nov 12, 2017

@emgk could you try

composer require --dev wp-cli/wp-cli:dev-master

and see if that fixes things for you?

@emgk
Copy link
Contributor Author

emgk commented Nov 23, 2017

@danielbachhuber I have added the functional test could you please check it?

@schlessera
Copy link
Member

@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 post_title as well as the post_name (slug).

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:

When I run `wp post list --format=count`
And save STDOUT as {POST_COUNT}

Then, you can use {POST_COUNT} anywhere in the tests to have it be replaced by that number.

@emgk
Copy link
Contributor Author

emgk commented Nov 24, 2017

@schlessera I have made changes according as per your comment could you please check?

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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem @schlessera I have hard-coded the number of posts. please check.

@schlessera schlessera added the command:post-generate Related to 'post generate' command label Nov 29, 2017
@schlessera schlessera added this to the 1.1.4 milestone Nov 29, 2017
@schlessera schlessera merged commit 8d1e1d3 into wp-cli:master Nov 29, 2017
@schlessera
Copy link
Member

Thanks for the PR and the perseverance, @emgk !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:post-generate Related to 'post generate' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants