Problem/Motivation

When running a Simpletest test case with a profile that is different from the main installation one, some caches might contain values from the main installation, causing test failures.

For example, having Views and Entity API enabled in the main installation, then drupal_static_reset() will end up having the field static cache populated with values from the main installation while those fields are not available in the test profile.

This is caused by DrupalCacheArray::_destruct() call, which calls ThemeRegistry::set(), which reinitializes the registry through ThemeRegistry::initializeRegistry().
Views and then Entity API hooks will be called, ending up in a request to field_info_fields(), that populates the static cache.

Proposed resolution

Do another drupal_static_reset() after changing the database prefix in DrupalWebTestCase::setUp(). The first drupal_static_reset() call has to stay because otherwise you will get critical exceptions about database records not available on the new test installation.

Remaining tasks

Test coverage for this use case.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sardara created an issue. See original summary.

sardara’s picture

Assigned: sardara » Unassigned
Status: Active » Needs review
FileSize
742 bytes