The teardown method in tests/webform.test removes all nodes for a certain user ID and then deletes the user account. Somehow, running the test script as user 1 all nodes that do not belong to user 1 are deleted regardless of their type.

I tried a fix of the query:

foreach ($this->webform_users as $user) {
  $uid = $user->uid;
  $result = db_query('SELECT nid FROM {node} WHERE uid = %d', $uid);
  while ($node = db_fetch_array($result)) {
    node_delete($node['nid']);
  }
  user_delete(array(), $uid);
}

to

foreach ($this->webform_users as $user) {
  $uid = $user->uid;
  $result = db_query("SELECT nid FROM {node} WHERE uid = %d AND type = '%s'", $uid, 'webform');
  while ($node = db_fetch_array($result)) {
    node_delete($node['nid']);
  }
  user_delete(array(), $uid);
}

but this still results in existing webform nodes with uid 3 to be deleted.

I'll try to retrieve the cause to this and will report anything I find. Thanks in advance for any fixes!

Comments

teezee’s picture

Title: Webform tests teardown deletes nodes that should be deleted » Webform test teardown deletes nodes that should NOT be deleted

-update Sorry forgot the most important word NOT in the title :S

quicksketch’s picture

Status: Active » Fixed

I believe I fixed this problem as part of getting our tests working again in #678618: SimpleTest for webform in drupal 6. The key being I moved the parent:tearDown() call to the bottom of Webform's tearDown() method. Previously SimpleTest was tearing down first and removing a lot of information we needed in our own tearDown() call.

Status: Fixed » Closed (fixed)

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