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.
Comment | File | Size | Author |
---|---|---|---|
#2 | fix_wrong_drupal_static-2679557-2.patch | 742 bytes | sardara |
Comments
Comment #2
sardara CreditAttribution: sardara at Randstad Digital for Government of Flanders commented