mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-09 19:14:19 +01:00
ci enhancement: complete tearDown to cleanup transactions and cmdb changes properly
This commit is contained in:
@@ -136,6 +136,8 @@ class ItopDataTestCase extends ItopTestCase
|
||||
}
|
||||
}
|
||||
|
||||
CMDBObject::SetCurrentChange(null);
|
||||
|
||||
parent::tearDown();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,10 @@ class ItopTestCase extends TestCase
|
||||
|
||||
if (CMDBSource::IsInsideTransaction()) {
|
||||
// Nested transactions were opened but not finished !
|
||||
// Rollback to avoid side effects on next tests
|
||||
while (CMDBSource::IsInsideTransaction()) {
|
||||
CMDBSource::Query('ROLLBACK');
|
||||
}
|
||||
throw new MySQLTransactionNotClosedException('Some DB transactions were opened but not closed ! Fix the code by adding ROLLBACK or COMMIT statements !', []);
|
||||
}
|
||||
}
|
||||
@@ -312,4 +316,4 @@ class ItopTestCase extends TestCase
|
||||
}
|
||||
closedir($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user