Running tests from the command-line off the latest backport is generating a large volume of exceptions related to db_query(). I'm not seeing these if I run the test from admin/build/testing.

It appears to be an issue around db_prefixing during the setUp function. I'm seeing things like:

    Table 'drupal.simpletest805887system' doesn't exist
    query: SELECT * FROM simpletest805887system WHERE type = 'theme'

Comments

joshk’s picture

Isolated this to the file_check_directory() call in setUp for DrupalWebTestCase. Tracing.

joshk’s picture

Traced to the success message, and it's calling of t(), I think:

   drupal_set_message(t('The directory %directory has been created.', array('%directory' => $directory)));

t() calles theme('placeholder'), which inits the theme layer prior to the initialization of the rest of the system. I'm unsure why this only causes problems when run from the CLI, but suspect it's because web-triggered test cases already have themes initialized?

joshk’s picture

Ok, a quick and harmless, though slightly kludgy fix is to add an earlier call that will init the theme layer's static vars. So, for instance, right after we set up the $db_prefix_new, if we add:

    $this->pass(t('Starting run with db_prefix %prefix', array('%prefix' => $db_prefix_new)));

Our exceptions go away. Will leave it to wiser heads to figure out if this is a good solution or not.

joshk’s picture

StatusFileSize
new1.03 KB

Just in case you like this idea, here's a patch against the current DRUPAL-6--2 branch.

boombatower’s picture

Status: Active » Needs review
StatusFileSize
new2.09 KB

Good job tracking that down. One side effect is that is causes simpletest.test to fail. Fixed in patch.

boombatower’s picture

Title: run-test.sh generates many exception » Theme laying needs to be initialized during setUp()
Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

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