You are here

function mongodb_test_group_finished in MongoDB 7

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

Implements hook_test_group_finished().

Testing helper: cleanup after test group.

Throws

\InvalidArgumentException If the database cannot be selected.

\MongoConnectionException If the connection cannot be established.

File

./mongodb.module, line 316
Contains the main module connecting Drupal to 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);
      }
    }
  }
}