public static function restoreTestDb()
 {
     $dbName = Kwf_Test_SeparateDb::getDbName();
     if ($dbName) {
         $testDb = Kwf_Test::getTestDb();
         // alte test-dbs löschen
         $testDatabases = $testDb->query('SHOW DATABASES')->fetchAll();
         foreach ($testDatabases as $testDatabase) {
             if (preg_match('/^test_[^_]+_([0-9]+)_[0-9]+_[^_]+$/', $testDatabase['Database'], $matches)) {
                 // test-db löschen wenn sie älter als 2 tage is
                 if ((int) $matches[1] < (int) date('Ymd', time() - 2 * 86400)) {
                     $testDb->query('DROP DATABASE ' . $testDatabase['Database']);
                 }
             }
         }
         $testDb->query('DROP DATABASE ' . $dbName);
         Kwf_Test_SeparateDb::$_dbName = null;
         Kwf_Registry::set('db', $testDb);
     }
 }