You are here

function mongodb_test_group_finished in MongoDB 6

Same name and namespace in other branches
  1. 7 mongodb.module \mongodb_test_group_finished()

Testing helper: cleanup after test group.

File

./mongodb.module, line 252
A library of common mechanisms for modules using MongoDB.

Code

function mongodb_test_group_finished() {
  $aliases = variable_get('mongodb_connections', array());
  $aliases['default'] = TRUE;
  foreach (array_keys($aliases) as $alias) {
    $db = mongodb($alias);
    foreach ($db
      ->listCollections() as $collection) {
      if (preg_match('/\\.simpletest\\d+/', $collection)) {
        $db
          ->dropCollection($collection);
      }
    }
  }
}