#31463 closed defect (bug) (fixed)
Avoid reaching inside the object cache object in tests
Reported by: | rmccue | Owned by: | spacedmonkey |
---|---|---|---|
Milestone: | 6.3 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch has-unit-tests commit |
Focuses: | Cc: |
Description
It'd be really fantastically great if WP_UnitTestCase::flush_cache
could keep its hands off my internal properties. :)
Right now, flush_cache
reaches into $wp_object_cache
and messes with a bunch of internal properties:
$wp_object_cache->group_ops = array(); $wp_object_cache->stats = array(); $wp_object_cache->memcache_debug = array(); $wp_object_cache->cache = array();
If we could just not do that, that'd be greaaaat.
Attachments (1)
Change History (14)
#3
@
10 years ago
- Keywords has-patch added; needs-patch removed
I couldn't find anywhere that was actually setting these properties anyway. I don't know if I'm missing something but I don't see a purpose for these lines. The $wp_object_cache->cache = array();
seems to be redundant as that's what wp_cache_flush does.
#4
@
10 years ago
@voldemortensen FWIW, those lines are included for external object caches, not the core classes. Those properties, and __remoteset
are used by Memcache, but others might use something different (I don't think __remoteset
is even used in a published object cache, I think it's only used by the internal wp.com one)
See https://plugins.trac.wordpress.org/browser/memcached/tags/2.0.2/object-cache.php#L189 and https://plugins.trac.wordpress.org/browser/memcached-redux/tags/0.1.3/object-cache.php#L215
I guess we'd have to add a new method/parameter to do this, and even possibly include the back-compat code here.
#5
@
10 years ago
- Milestone changed from 4.2 to Future Release
Moving off of the 4.2 milestone as this is a release-independent change.
This ticket was mentioned in PR #4417 on WordPress/wordpress-develop by @spacedmonkey.
17 months ago
#7
- Keywords has-unit-tests added
Trac ticket: https://core.trac.wordpress.org/ticket/31463
#8
@
17 months ago
- Keywords commit added
- Milestone changed from Future Release to 6.3
- Owner set to spacedmonkey
- Status changed from new to assigned
This ticket was mentioned in Slack in #hosting-community by spacedmonkey. View the logs.
17 months ago
@tillkruess commented on PR #4417:
17 months ago
#10
LGTM
@spacedmonkey commented on PR #4417:
17 months ago
#12
#13
@
14 months ago
Mentioned in dev note - https://make.wordpress.org/core/2023/07/17/improvements-to-the-cache-api-in-wordpress-6-3/
Introduced in https://core.trac.wordpress.org/changeset/760/tests