Make WordPress Core

Opened 6 years ago

Last modified 6 years ago

#110 new enhancement

Public functions for cache should be directly tested

Reported by: tollmanz Owned by:
Milestone: Priority: normal
Component: Cache Keywords:
Cc: tollmanz@…


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)

cacheFunctional.patch (589 bytes) - added by bananastalktome 6 years ago.

Download all attachments as: .zip

Change History (7)

#1 @nacin
6 years ago

Good reason why they should be tested: #WP21327.

#2 @nacin
6 years ago

(In [932]) Duplicate cache method tests for incr() decr() and delete(), for wp_cache_incr() wp_cache_decr() wp_cache_delete(). see #110. see #WP21327.

#3 @nacin
6 years ago

[932] could surely be done better, and we're not even testing groups in tests/cache.php, but it's a start.

#4 @nacin
6 years ago

(In [933]) wp_cache_delete() does not have a $force method. see #110.

#5 @bananastalktome
6 years 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?

#6 @tollmanz
6 years ago

  • 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.

Note: See TracTickets for help on using tickets.