Skip to content

Add term recount command#2625

Merged
danielbachhuber merged 10 commits into
wp-cli:masterfrom
petenelson:feature/term-recount
Apr 6, 2016
Merged

Add term recount command#2625
danielbachhuber merged 10 commits into
wp-cli:masterfrom
petenelson:feature/term-recount

Conversation

@petenelson
Copy link
Copy Markdown

Fixes #2621

@danielbachhuber
Copy link
Copy Markdown
Member

Can you make sure to include functional tests? http://wp-cli.org/docs/pull-requests/#functional-tests

@petenelson
Copy link
Copy Markdown
Author

Will do!

@danielbachhuber
Copy link
Copy Markdown
Member

Thanks :) and you can create a new features/term-recount.feature file for them

"""
Success: Updated category term count
Success: Updated post_tag term count
"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What do you think about adding a test for ensuring wp_update_term_count() works as expected? As in, setting the count field in the database to an incorrect value, and then triggering recount to ensure it gets updated to the expected value?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Talking about running a manual SQL update to the wp_term_taxonomy table, then running the recount function and verifying the change afterward? Sure, that makes sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Talking about running a manual SQL update to the wp_term_taxonomy table, then running the recount function and verifying the change afterward?

Yep

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Cool, I took a look at the comment-recount.feature and that'll get me started in the right direction for the test.

When I run `wp term recount category`
And I run `wp term get category {TERM_ID} --field=count`
"""
1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good

@danielbachhuber danielbachhuber added this to the 0.24.0 milestone Apr 6, 2016
@danielbachhuber danielbachhuber changed the title Feature/term recount Add term recount command Apr 6, 2016
@danielbachhuber danielbachhuber merged commit 369815a into wp-cli:master Apr 6, 2016
@danielbachhuber
Copy link
Copy Markdown
Member

Thanks again for your work on this, @petenelson !

@petenelson
Copy link
Copy Markdown
Author

You're welcome, and thank you for inspiring me to start adding unit tests and CI to my own projects!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants