WordPress.org

Make WordPress Core

Opened 21 months ago

Last modified 21 months 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@…

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)

cacheFunctional.patch (589 bytes) - added by bananastalktome 21 months ago.

Download all attachments as: .zip

Change History (7)

comment:1 nacin21 months ago

Good reason why they should be tested: #WP21327.

comment:2 nacin21 months 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.

comment:3 nacin21 months ago

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

comment:4 nacin21 months ago

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

comment:5 bananastalktome21 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?

comment:6 tollmanz21 months 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.