This patch - http://drupal.org/node/402896#comment-4563554 fails horribly with simpletest.

Here's why:

- CacheArrayObject has a __destruct() function, this tries to acquire a lock and/or cache_set() - which in core hits the database.

- the patch was adding the schema CacheArrayObject() to drupal_static()

- DrupalUnitTestCase::setUp() calls drupal_static_reset()

- drupal_static_reset() takes the static variable out of scope.

- this calls the object destructor, which queries the database, except it's no longer there.

Possible options:

1. Remove the drupal_static_reset() - afaik all tests pass with it removed and it's there theoretically.

2. Call drupal_static_reset() before the database is moved out of the way, it could be called again later on too if necessary.

CommentFileSizeAuthor
#2 destruct.patch1.11 KBcatch
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Issue tags: +Testing system
catch’s picture

Status: Active » Needs review
FileSize
1.11 KB

Here's a patch.

sun’s picture

+++ b/modules/simpletest/drupal_web_test_case.php
@@ -1238,6 +1238,10 @@ class DrupalWebTestCase extends DrupalTestCase {
     // Clone the current connection and replace the current prefix.
     $connection_info = Database::getConnectionInfo('default');
     Database::renameConnection('default', 'simpletest_original_default');

Don't we have to backup the DB connection info first, so we can restore it later?

14 days to next Drupal core point release.

catch’s picture

That's neither held in drupal_static() nor $conf though..

sun’s picture

Status: Needs review » Fixed

This has been fixed via #1541958: Split setUp() into specific sub-methods and/or some other patches already.

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