Add pluck/patch commands for caches and transients
Add commands for plucking and patching values from object cache and transient.
Fixes #26
I cannot reproduce the failures for the functional tests locally :
$ composer behat
> run-behat-tests
...................................................................... 70
...................................................................... 140
...................................................................... 210
...................................................................... 280
...................................................................... 350
................
20 scénarios (20 succès)
366 étapes (366 succès)
4m20.27s (10.47Mb)
Seem's like the mu-plugins used to set up those scenarios are not loaded.
Unfortunately can't reproduce locally either.
Looks like $current_value is null, so the wp_cache_get() call in the patch() method is returning null for some reason..?
Adding some WP_CLI::log( var_export( wp_cache_get( 'my_key' ), true ) ); calls to within $set_foo could help debug this.
I manage to reproduce the failling tests locally after rebasing main in the branch, I'll look into it.
Scratch that, it was an issue with the rebase 🥲
@danielbachhuber I've split the tests into dedicated files and update them to use When I run if they're expected to succeed.
In https://github.com/wp-cli/cache-command/pull/89/commits/327d99a13cef3601fd8304006efaeb9396821e88 I added two debug statement to try to understand why the tests are failing in Github CI.
@danielbachhuber I was finally able to fix the failures for the functional tests. It was related to the use of STDIN to get the new value, which didn't properly handle the case where it was empty.
All tests are green on my fork.
What's left to do on this PR?
Hi @johnbillion, sorry for the delay.
I didn't had the time to look at Daniel comments yet. I'll try to check them this week and finish up this PR for a new review.
Hi @danielbachhuber,
I've refactored the feature tests to address your feedbacks, this should be good to go.
All tests workflows using MySQL are green, the ones with SQLite are failing, but doesn't seem related to this PR specifically (eg: Functional - WP latest on 8.2 with SQLite).
SQLite errors are known, see #92
Hi, this PR should be ready for final review, the failling tests are related to SQLite errors and not to the changes in this PR.
Codecov Report
Attention: Patch coverage is 84.87395% with 18 lines in your changes missing coverage. Please review.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/Transient_Command.php | 83.33% | 10 Missing :warning: |
| src/Cache_Command.php | 86.44% | 8 Missing :warning: |
:loudspeaker: Thoughts on this report? Let us know!
Thanks for all the work on this, @petitphp !