Problem/Motivation

The MemcacheTestCase class only configures cache_memcache as a memcache bin, however some tests use the default cache bin or extend DrupalWebTestCase directly, skipping the cache bin setup completely.

Although memcache supports the cache bin by default internally, Drupal still needs cache_class_cache* or cache_default_class to be configured before the first call to cache_get() on each bin for this to work. See _cache_get_object().

The lock and session test cases do not configure memcache support first, relying on them being configured in settings.php (which is not documented). If this is not configured, the tests pass anyway using the default core backends instead.

Proposed resolution

At the very least all test cases should assert whether the cache bin(s) they are testing against are using memcache and fail if not.

CommentFileSizeAuthor
#1 memcache-tests-1995556-1.patch9.61 KBmarkpavlitski

Comments

markpavlitski’s picture

Status: Active » Needs review
StatusFileSize
new9.61 KB

This patch ensures all tests implement MemcacheTestCase and adds additional tests to confirm if memcache backends are being used.

MemcacheTestCase::setUp() needed to be re-implemented, so that $conf variables can be set prior to test site installation.

markpavlitski’s picture

Issue summary: View changes
markpavlitski’s picture

Issue summary: View changes
jeremy’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.