diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 77458a1..00be5b0 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -2507,7 +2507,7 @@ function typed_data() { function drupal_valid_test_ua() { global $drupal_hash_salt; // No reason to reset this. - static $test_prefix; +// static $test_prefix; if (isset($test_prefix)) { return $test_prefix; diff --git a/core/lib/Drupal/Core/Cache/ApcBackend.php b/core/lib/Drupal/Core/Cache/ApcBackend.php new file mode 100644 index 0000000..3bb771e --- /dev/null +++ b/core/lib/Drupal/Core/Cache/ApcBackend.php @@ -0,0 +1,380 @@ +bin = $bin; + + // First we determine the prefix from a setting. + $prefix = self::getPrefixSettingForBin($this->bin); + + // If we do not have a configured prefix we use the HTTP_HOST. + if (empty($prefix) && isset($_SERVER['HTTP_HOST'])) { + // Provide a fallback for multisite. This is on purpose not inside the + // getPrefixForBin() function in order to decouple the unified prefix + // variable logic and custom module related security logic, that is not + // necessary for all backends. + $prefix = $_SERVER['HTTP_HOST'] . '::'; + } + else { + $prefix = $prefix . '::'; + } + + // When we are in testing mode we add the test prefix. + if ($test_prefix = drupal_valid_test_ua()) { + debug('prefix'); + $prefix = $test_prefix . '::' . $prefix; + } + elseif (isset($GLOBALS['drupal_test_info'])) { + debug('global'); + $prefix = $GLOBALS['drupal_test_info']['test_run_id'] . '::' . $prefix; + } + + $this->prefix = $prefix; + } + + /** + * Get prefix for bin using the configuration. + * + * @param string $bin + * + * @return string + * Can be an empty string, if no prefix set. + */ + protected static function getPrefixSettingForBin($bin) { + $prefixes = variable_get('cache_prefix', ''); + + if (is_string($prefixes)) { + // Variable can be a string, which then considered as a default behavior. + return $prefixes; + } + + if (isset($prefixes[$bin])) { + if (FALSE !== $prefixes[$bin]) { + // If entry is set and not FALSE, an explicit prefix is set for the bin. + return $prefixes[$bin]; + } + else { + // If we have an explicit false, it means no prefix whatever is the + // default configuration. + return ''; + } + } + else { + // Key is not set, we can safely rely on default behavior. + if (isset($prefixes['default']) && FALSE !== $prefixes['default']) { + return $prefixes['default']; + } + else { + // When default is not set or an explicit FALSE, this means no prefix. + return ''; + } + } + } + + /** + * Function which retrieves the safe key for the cache bin. + * + * @return string + * The safe APC key. + */ + protected function binKey() { + return $this->prefix . $this->bin . '::'; + } + + /** + * Function which retrieves the safe key for the cache cid. + * + * @param string $cid + * The cache id. + * @return string + * The safe APC key. + */ + protected function key($cid) { + return $this->binKey() . $cid; + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::get(). + */ + public function get($cid) { + $cache = apc_fetch($this->key($cid)); + return $this->prepareItem($cache); + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple(). + */ + public function getMultiple(&$cids) { + // Translate the requested cache item keys to APC keys. + $map = array(); + foreach ($cids as $cid) { + $map[$this->key($cid)] = $cid; + } + + $result = apc_fetch(array_keys($map)); + $cache = array(); + foreach ($result as $key => $item) { + $item = $this->prepareItem($item); + if ($item) { + $cache[$map[$key]] = $item; + } + } + unset($result); + + $cids = array_diff($cids, array_keys($cache)); + return $cache; + } + + /** + * Returns all cached items, optionally limited by a cache ID prefix. + * + * APC is a memory cache, shared across all server processes. To prevent cache + * item clashes with other applications/installations, every cache item is + * prefixed with a unique string for this application. Therefore, functions + * like apc_clear_cache() cannot be used, and instead, a list of all cache + * items belonging to this application need to be retrieved through this + * method instead. + * + * @param string $prefix + * (optional) A cache ID prefix to limit the result to. + * + * @return APCIterator + * An APCIterator containing matched items. + */ + public function getAll($prefix = '') { + return new \APCIterator('user', '/^' . preg_quote($this->binKey() . $prefix, '/') . '/', APC_ITER_KEY); + } + + /** + * Prepares a cached item. + * + * Checks that items are either permanent or did not expire. + * + * @param stdClass $cache + * An item loaded from cache_get() or cache_get_multiple(). + * + * @return mixed + * The item with data unserialized as appropriate or FALSE if there is no + * valid item to load. + */ + protected function prepareItem($cache) { + if (!isset($cache->data)) { + return FALSE; + } + + // The cache data is invalid if any of its tags have been cleared since. + if ($cache->tags) { + $cache->tags = explode(' ', $cache->tags); + if (!$this->validTags($cache->checksum, $cache->tags)) { + return FALSE; + } + } + + return $cache; + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::set(). + */ + public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) { + $cache = new \stdClass(); + $cache->cid = $cid; + $cache->created = REQUEST_TIME; + $cache->expire = $expire; + $cache->tags = implode(' ', $this->flattenTags($tags)); + $cache->checksum = $this->checksumTags($tags); + + // APC serializes/unserializes any structure itself. + $cache->serialized = 0; + $cache->data = $data; + + // apc_store()'s $ttl argument can be omitted but also set to 0 (zero), + // which happens to be identical to CACHE_PERMANENT. + apc_store($this->key($cid), $cache, $expire); + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::delete(). + */ + public function delete($cid) { + apc_delete($this->key($cid)); + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). + */ + public function deleteMultiple(array $cids) { + apc_delete(array_map(array($this, 'key'), $cids)); + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::flush(). + */ + public function flush() { + $iterator = $this->getAll(); +// debug($iterator); + foreach ($iterator as $key => $data) { +// debug($key); + apc_delete($key); + } + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::expire(). + */ + public function expire() { + // Any call to apc_fetch() causes APC to expunge expired items. + apc_fetch(''); + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). + */ + public function garbageCollection() { + $this->expire(); + } + + /** + * Compares two checksums of tags. Used to determine whether to serve a cached + * item or treat it as invalidated. + * + * @param integer $checksum + * The initial checksum to compare against. + * @param array $tags + * An array of tags to calculate a checksum for. + * + * @return boolean + * TRUE if the checksums match, FALSE otherwise. + */ + protected function validTags($checksum, array $tags) { + return $checksum == $this->checksumTags($tags); + } + + /** + * Flattens a tags array into a numeric array suitable for string storage. + * + * @param array $tags + * Associative array of tags to flatten. + * + * @return array + * Numeric array of flattened tag identifiers. + */ + protected function flattenTags(array $tags) { + if (isset($tags[0])) { + return $tags; + } + + $flat_tags = array(); + foreach ($tags as $namespace => $values) { + if (is_array($values)) { + foreach ($values as $value) { + $flat_tags[] = "$namespace:$value"; + } + } + else { + $flat_tags[] = "$namespace:$values"; + } + } + return $flat_tags; + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). + */ + public function invalidateTags(array $tags) { + foreach ($this->flattenTags($tags) as $tag) { + unset(self::$tagCache[$tag]); + apc_inc($this->prefix . 'tags::' . $tag, 1, $success); + if (!$success) { + apc_store($this->prefix . 'tags::' . $tag, 1); + } + } + } + + /** + * Returns the sum total of validations for a given set of tags. + * + * @param array $tags + * Associative array of tags. + * + * @return integer + * Sum of all invalidations. + */ + protected function checksumTags($tags) { + $checksum = 0; + $query_tags = array(); + + foreach ($this->flattenTags($tags) as $tag) { + if (isset(self::$tagCache[$tag])) { + $checksum += self::$tagCache[$tag]; + } + else { + $query_tags[] = $this->prefix . 'tags::' . $tag; + } + } + if ($query_tags) { + $result = apc_fetch($query_tags); + self::$tagCache = array_merge(self::$tagCache, $result); + $checksum += array_sum($result); + } + return $checksum; + } + + /** + * Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty(). + */ + public function isEmpty() { + return $this->getAll()->getTotalCount() === 0; + } +} + +// PHP CLI uses a different php.ini in which APC may not be enabled. +// Create stub functions to prevent fatal errors. +if (drupal_is_cli() && !function_exists('apc_fetch')) { + function apc_fetch($key, &$success) { + $success = TRUE; + return FALSE; + } + function apc_store($key, $var) { + return FALSE; + } + function apc_delete($key) { + return FALSE; + } + function apc_inc($key, $step, &$success) { + $success = TRUE; + return FALSE; + } +} diff --git a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php index 02c9dd2..9c4f8fc 100644 --- a/core/lib/Drupal/Core/Cache/CacheBackendInterface.php +++ b/core/lib/Drupal/Core/Cache/CacheBackendInterface.php @@ -38,8 +38,8 @@ * To access your custom cache bin, specify the name of the bin when storing * or retrieving cached data: * @code - * cache_set($cid, $data, 'custom_bin', $expire); - * cache_get($cid, 'custom_bin'); + * cache('custom_bin')->set($cid, $data, $expire); + * cache('custom_bin')->get($cid); * @endcode * * @see cache() @@ -60,7 +60,7 @@ * @param $bin * The cache bin for which the object is created. */ - function __construct($bin); + public function __construct($bin); /** * Returns data from the persistent cache. @@ -74,7 +74,7 @@ function __construct($bin); * @return * The cache or FALSE on failure. */ - function get($cid); + public function get($cid); /** * Returns data from the persistent cache when given an array of cache IDs. @@ -87,7 +87,7 @@ function get($cid); * @return * An array of the items successfully returned from cache indexed by cid. */ - function getMultiple(&$cids); + public function getMultiple(&$cids); /** * Stores data in the persistent cache. @@ -111,7 +111,7 @@ function getMultiple(&$cids); * a node, both the node ID and the author's user ID might be passed in as * tags. For example array('node' => array(123), 'user' => array(92)). */ - function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()); + public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()); /** * Deletes an item from the cache. @@ -119,7 +119,7 @@ function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, arra * @param $cid * The cache ID to delete. */ - function delete($cid); + public function delete($cid); /** * Deletes multiple items from the cache. @@ -127,17 +127,17 @@ function delete($cid); * @param $cids * An array of $cids to delete. */ - function deleteMultiple(Array $cids); + public function deleteMultiple(Array $cids); /** * Flushes all cache items in a bin. */ - function flush(); + public function flush(); /** * Expires temporary items from the cache. */ - function expire(); + public function expire(); /** * Invalidates each tag in the $tags array. @@ -148,12 +148,12 @@ function expire(); * * @see CacheBackendInterface::set() */ - function invalidateTags(array $tags); + public function invalidateTags(array $tags); /** * Performs garbage collection on a cache bin. */ - function garbageCollection(); + public function garbageCollection(); /** * Checks if a cache bin is empty. @@ -164,5 +164,5 @@ function garbageCollection(); * @return * TRUE if the cache bin specified is empty. */ - function isEmpty(); + public function isEmpty(); } diff --git a/core/lib/Drupal/Core/Cache/DatabaseBackend.php b/core/lib/Drupal/Core/Cache/DatabaseBackend.php index e62f1da..9ab6b11 100644 --- a/core/lib/Drupal/Core/Cache/DatabaseBackend.php +++ b/core/lib/Drupal/Core/Cache/DatabaseBackend.php @@ -31,7 +31,7 @@ class DatabaseBackend implements CacheBackendInterface { /** * Implements Drupal\Core\Cache\CacheBackendInterface::__construct(). */ - function __construct($bin) { + public function __construct($bin) { // All cache tables should be prefixed with 'cache_', except for the // default 'cache' bin. if ($bin != 'cache') { @@ -43,7 +43,7 @@ function __construct($bin) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::get(). */ - function get($cid) { + public function get($cid) { $cids = array($cid); $cache = $this->getMultiple($cids); return reset($cache); @@ -52,7 +52,7 @@ function get($cid) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple(). */ - function getMultiple(&$cids) { + public function getMultiple(&$cids) { try { // When serving cached pages, the overhead of using ::select() was found // to add around 30% overhead to the request. Since $this->bin is a @@ -93,8 +93,6 @@ function getMultiple(&$cids) { * valid item to load. */ protected function prepareItem($cache) { - global $user; - if (!isset($cache->data)) { return FALSE; } @@ -118,7 +116,7 @@ protected function prepareItem($cache) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::set(). */ - function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) { + public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) { $fields = array( 'serialized' => 0, 'created' => REQUEST_TIME, @@ -149,7 +147,7 @@ function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, arra /** * Implements Drupal\Core\Cache\CacheBackendInterface::delete(). */ - function delete($cid) { + public function delete($cid) { Database::getConnection()->delete($this->bin) ->condition('cid', $cid) ->execute(); @@ -158,7 +156,7 @@ function delete($cid) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). */ - function deleteMultiple(array $cids) { + public function deleteMultiple(array $cids) { // Delete in chunks when a large array is passed. do { Database::getConnection()->delete($this->bin) @@ -171,14 +169,14 @@ function deleteMultiple(array $cids) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::flush(). */ - function flush() { + public function flush() { Database::getConnection()->truncate($this->bin)->execute(); } /** * Implements Drupal\Core\Cache\CacheBackendInterface::expire(). */ - function expire() { + public function expire() { Database::getConnection()->delete($this->bin) ->condition('expire', CacheBackendInterface::CACHE_PERMANENT, '<>') ->condition('expire', REQUEST_TIME, '<') @@ -188,7 +186,7 @@ function expire() { /** * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). */ - function garbageCollection() { + public function garbageCollection() { $this->expire(); } @@ -196,9 +194,9 @@ function garbageCollection() { * Compares two checksums of tags. Used to determine whether to serve a cached * item or treat it as invalidated. * - * @param integer @checksum + * @param integer $checksum * The initial checksum to compare against. - * @param array @tags + * @param array $tags * An array of tags to calculate a checksum for. * * @return boolean @@ -214,7 +212,7 @@ protected function validTags($checksum, array $tags) { * @param array $tags * Associative array of tags to flatten. * - * @return + * @return array * Numeric array of flattened tag identifiers. */ protected function flattenTags(array $tags) { @@ -288,7 +286,7 @@ protected function checksumTags($tags) { /** * Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty(). */ - function isEmpty() { + public function isEmpty() { $this->garbageCollection(); $query = Database::getConnection()->select($this->bin); $query->addExpression('1'); diff --git a/core/lib/Drupal/Core/Cache/InstallBackend.php b/core/lib/Drupal/Core/Cache/InstallBackend.php index 73aae39..e23294a 100644 --- a/core/lib/Drupal/Core/Cache/InstallBackend.php +++ b/core/lib/Drupal/Core/Cache/InstallBackend.php @@ -36,26 +36,26 @@ class InstallBackend extends DatabaseBackend { /** * Overrides Drupal\Core\Cache\DatabaseBackend::get(). */ - function get($cid) { + public function get($cid) { return FALSE; } /** * Overrides Drupal\Core\Cache\DatabaseBackend::getMultiple(). */ - function getMultiple(&$cids) { + public function getMultiple(&$cids) { return array(); } /** * Overrides Drupal\Core\Cache\DatabaseBackend::set(). */ - function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) {} + public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) {} /** * Overrides Drupal\Core\Cache\DatabaseBackend::delete(). */ - function delete($cid) { + public function delete($cid) { try { if (class_exists('Drupal\Core\Database\Database')) { parent::delete($cid); @@ -67,7 +67,7 @@ function delete($cid) { /** * Overrides Drupal\Core\Cache\DatabaseBackend::deleteMultiple(). */ - function deleteMultiple(array $cids) { + public function deleteMultiple(array $cids) { try { if (class_exists('Drupal\Core\Database\Database')) { parent::deleteMultiple($cids); @@ -79,7 +79,7 @@ function deleteMultiple(array $cids) { /** * Overrides Drupal\Core\Cache\DatabaseBackend::invalidateTags(). */ - function invalidateTags(array $tags) { + public function invalidateTags(array $tags) { try { if (class_exists('Drupal\Core\Database\Database')) { parent::invalidateTags($tags); @@ -91,7 +91,7 @@ function invalidateTags(array $tags) { /** * Overrides Drupal\Core\Cache\DatabaseBackend::flush(). */ - function flush() { + public function flush() { try { if (class_exists('Drupal\Core\Database\Database')) { parent::flush(); @@ -103,7 +103,7 @@ function flush() { /** * Overrides Drupal\Core\Cache\DatabaseBackend::expire(). */ - function expire() { + public function expire() { try { if (class_exists('Drupal\Core\Database\Database')) { parent::expire(); @@ -115,7 +115,7 @@ function expire() { /** * Overrides Drupal\Core\Cache\DatabaseBackend::garbageCollection(). */ - function garbageCollection() { + public function garbageCollection() { try { if (class_exists('Drupal\Core\Database\Database')) { parent::garbageCollection(); @@ -127,7 +127,7 @@ function garbageCollection() { /** * Overrides Drupal\Core\Cache\DatabaseBackend::isEmpty(). */ - function isEmpty() { + public function isEmpty() { try { if (class_exists('Drupal\Core\Database\Database')) { return parent::isEmpty(); diff --git a/core/lib/Drupal/Core/Cache/MemoryBackend.php b/core/lib/Drupal/Core/Cache/MemoryBackend.php index ce74c2f..b17e06b 100644 --- a/core/lib/Drupal/Core/Cache/MemoryBackend.php +++ b/core/lib/Drupal/Core/Cache/MemoryBackend.php @@ -105,13 +105,13 @@ public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANEN ); } - /* + /** * Calculates a checksum so data can be invalidated using tags. */ - function checksum($tags) { - $checksum = ""; + public function checksum($tags) { + $checksum = ''; - foreach($tags as $tag) { + foreach ($tags as $tag) { // Has the tag already been invalidated. if (isset($this->invalidatedTags[$tag])) { $checksum = $checksum . $tag . ':' . $this->invalidatedTags[$tag]; @@ -201,8 +201,7 @@ protected function flattenTags(array $tags) { * Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). */ public function invalidateTags(array $tags) { - $flat_tags = $this->flattenTags($tags); - foreach($flat_tags as $tag) { + foreach ($this->flattenTags($tags) as $tag) { if (isset($this->invalidatedTags[$tag])) { $this->invalidatedTags[$tag] = $this->invalidatedTags[$tag] + 1; } diff --git a/core/lib/Drupal/Core/Cache/NullBackend.php b/core/lib/Drupal/Core/Cache/NullBackend.php index 862a3bd..ee8b1d3 100644 --- a/core/lib/Drupal/Core/Cache/NullBackend.php +++ b/core/lib/Drupal/Core/Cache/NullBackend.php @@ -23,51 +23,51 @@ class NullBackend implements CacheBackendInterface { /** * Implements Drupal\Core\Cache\CacheBackendInterface::__construct(). */ - function __construct($bin) {} + public function __construct($bin) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::get(). */ - function get($cid) { + public function get($cid) { return FALSE; } /** * Implements Drupal\Core\Cache\CacheBackendInterface::getMultiple(). */ - function getMultiple(&$cids) { + public function getMultiple(&$cids) { return array(); } /** * Implements Drupal\Core\Cache\CacheBackendInterface::set(). */ - function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) {} + public function set($cid, $data, $expire = CacheBackendInterface::CACHE_PERMANENT, array $tags = array()) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::delete(). */ - function delete($cid) {} + public function delete($cid) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::deleteMultiple(). */ - function deleteMultiple(array $cids) {} + public function deleteMultiple(array $cids) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::flush(). */ - function flush() {} + public function flush() {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::expire(). */ - function expire() {} + public function expire() {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::garbageCollection(). */ - function garbageCollection() {} + public function garbageCollection() {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::invalidateTags(). @@ -77,7 +77,7 @@ public function invalidateTags(array $tags) {} /** * Implements Drupal\Core\Cache\CacheBackendInterface::isEmpty(). */ - function isEmpty() { + public function isEmpty() { return TRUE; } } diff --git a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php index 7320a74..a2548f6 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/TestBase.php @@ -829,6 +829,12 @@ protected function tearDown() { $this->pass($message, t('E-mail')); } + // Reset all static variables. + // Static variables may contain objects with magic destructors; resetting + // all statics causes them to be invoked and they might write data based on + // the environment information they were given within the test. + drupal_static_reset(); + // Delete temporary files directory. file_unmanaged_delete_recursive($this->originalFileDirectory . '/simpletest/' . substr($this->databasePrefix, 10), array($this, 'filePreDeleteCallback')); @@ -844,9 +850,6 @@ protected function tearDown() { $GLOBALS['theme_key'] = $this->originalThemeKey; $GLOBALS['theme'] = $this->originalTheme; - // Reset all static variables. - drupal_static_reset(); - // Reset module list and module load status. module_list_reset(); module_load_all(FALSE, TRUE); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php index 98ed71d..7d3251d 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/UnitTestBase.php @@ -67,7 +67,13 @@ protected function setUp() { } // Set user agent to be consistent with WebTestBase. - $_SERVER['HTTP_USER_AGENT'] = $this->databasePrefix; + // @see WebTestBase::curlInitialize() +// $this->originalUserAgent = $_SERVER['HTTP_USER_AGENT']; + if (preg_match('/simpletest\d+/', $this->databasePrefix, $matches)) { +// debug($this->databasePrefix); + $_SERVER['HTTP_USER_AGENT'] = drupal_generate_test_ua($matches[0]); +// debug($_SERVER['HTTP_USER_AGENT']); + } $this->setup = TRUE; } diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/ApcBackendUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/ApcBackendUnitTest.php new file mode 100644 index 0000000..1296886 --- /dev/null +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/ApcBackendUnitTest.php @@ -0,0 +1,39 @@ + 'APC cache backend', + 'description' => 'Tests the APC cache backend.', + 'group' => 'Cache', + ); + } + + protected function createCacheBackend($bin) { + return new ApcBackend($bin); + } +} diff --git a/core/modules/system/lib/Drupal/system/Tests/Cache/MemoryBackendUnitTest.php b/core/modules/system/lib/Drupal/system/Tests/Cache/MemoryBackendUnitTest.php index 843eb23..499ddaf 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Cache/MemoryBackendUnitTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Cache/MemoryBackendUnitTest.php @@ -2,7 +2,7 @@ /** * @file - * Definition of Drupal\system\Tests\Cache\ArrayBackendUnitTest. + * Definition of Drupal\system\Tests\Cache\MemoryBackendUnitTest. */ namespace Drupal\system\Tests\Cache;