I am using the following modules:

Drupal 6.16
SimpleTest 6.x-2.10
VotingAPI 6.x-2.3

When I perform the test with the Drupal search module disabled, everything is great (65 passes, 0 fails, and 0 exceptions). However, when the search module is enabled, the test throws 9 exceptions, all related to trying to delete database tables from the search node but not being able to find these tables (see attached screenshot).

I believe that there is a problem with the means by which the VotingAPI test file is building these nodes that is resulting in these tables not being created. I am trying to debug this problem myself, but am new to the whole unit testing environment.

Any thoughts/hypotheses/etc. would be appreciated.

CommentFileSizeAuthor
#1 simpletest-exceptions-739034.patch779 bytespifantastic

Comments

pifantastic’s picture

StatusFileSize
new779 bytes

We were experiencing the same issue, so I spent some time today tracking this down.

It's not really a problem with the VotingAPI module. The probably is actually a symptom of the way the SimpleTest module works. In this particular case, the exceptions are thrown because the test calls node_delete. From the node module:

/**
 * Delete a node.
 */
function node_delete($nid) {

    /* ... */

    // Remove this node from the search index if needed.
    if (function_exists('search_wipe')) {
      search_wipe($node->nid, 'node');
    }

    /* ... */
}

The VotingAPI simple test does not enable the search module before it runs therefore the search index database tables are never created. But, if you happen to have the search module enabled on your Drupal site, the function search_wipe WILL exist in the scope of the simple test, despite the fact that the search module is not installed.

There is no awesome way to fix this. There are three options as far as I can tell:

1.) Install the search module in the VotingAPI simpletest
2.) Replace instances in core of function_exists('search_wipe') with module_exists('search')
3.) Somehow run SimpleTest in its own scope.

2 is pretty much out of the question. No reason to make core slower to fix something in SimpleTest. 3 is like, hard. Maybe if SimpleTest was invoked from the command line it could be possible. I'm not sure.

So, I'm attaching a patch that takes approach #1.

pifantastic’s picture

Status: Active » Needs review
legolasbo’s picture

Issue summary: View changes
Status: Needs review » Closed (won't fix)

Drupal 6 is no longer supported. Closing old issues to clean up the issue queue.

Please reopen and update this issue if this is still an issue in the D7 or D8 version.