Opened 10 months ago
Last modified 10 months ago
#110 new enhancement
Public functions for cache should be directly tested
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Cache | Keywords: | |
| Cc: | tollmanz@… |
Description
The family of "wp_cache_*" functions should be tested. While it is great that the WP_Object_Cache class' methods are directly tested, this does not verify that the public wrapper functions are doing what they are intended to do. Since core (and hopefully plugins/themes) access the object cache through these functions, they need to be tested.
Attachments (1)
Change History (7)
[932] could surely be done better, and we're not even testing groups in tests/cache.php, but it's a start.
bananastalktome — 10 months ago
Actually, good request, as poking around with the wp_cache_* functions helped me notice a bug with wp_cache_decr (http://core.trac.wordpress.org/ticket/21327) where it will not decrement a cache value properly. First pass at a way to solve this without tons of duplication, but not sure how standard it is. Thoughts?
- Cc tollmanz@… added
I think these should be painstakingly written with the wrapper function in mind. Since the wrapper function rarely matches the corresponding WP_Object_Cache method with regard to default arguments, the wrappers need to be tested specifically and separately. That said, I would imagine that the tests can be copied and modified from there.

Good reason why they should be tested: #WP21327.