When originally created the SimpleTest db prefix overrides the original prefix:

$db_prefix = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');

The fact that the prefix is a string is assumed throughout the SimpleTest code, except in database.inc where it is picked up on the "tested" side (ex. during a drupalGet). This causes fun errors like:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'databasename.Arraysimpletest508950variable' doesn't exist in ~/includes/database/database.inc on line 1940

Call Stack:
    0.0002      78936   1. {main}() ~/index.php:0
    0.0042     650264   2. drupal_bootstrap() ~/index.php:21
    0.0052     665104   3. _drupal_bootstrap_page_cache() ~/includes/bootstrap.inc:1533
    0.0063     815120   4. drupal_bootstrap() ~/includes/bootstrap.inc:1595
    0.0104    1442696   5. _drupal_bootstrap_variables() ~/includes/bootstrap.inc:1541
    0.0104    1443432   6. variable_initialize() ~/includes/bootstrap.inc:1657
    0.0105    1445024   7. db_query() ~/includes/bootstrap.inc:730
    0.0157    1522520   8. DatabaseConnection->query() ~/includes/database/database.inc:2111

Thus completely crapping the tests. Note the "Arraysimpletest508950variable" "Array" part.

CommentFileSizeAuthor
#1 716394-db-prefix-force.patch841 bytesboombatower

Comments

boombatower’s picture

Assigned: Unassigned » boombatower
Status: Active » Needs review
StatusFileSize
new841 bytes
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed to HEAD.

I don't think it's possible to write tests for this, unfortunately.

Status: Fixed » Closed (fixed)

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