N°7803 Skip test if itop-hub-connector is not installed (new helper to handle this in any other tests)

This commit is contained in:
Romain Quetiez
2024-10-23 15:46:44 +02:00
parent 764eddd9f8
commit 674dfebb0d
2 changed files with 21 additions and 0 deletions

View File

@@ -1392,4 +1392,18 @@ abstract class ItopDataTestCase extends ItopTestCase
]);
return $sLogin;
}
/**
* Can be invoked in setUp or any test method to skip the test if the module is not present
*
* @param string $sModule e.g: itop-hub-connector
*
* @return void
*/
protected function SkipIfModuleNotPresent(string $sModule): void
{
if (!file_exists(\utils::GetAbsoluteModulePath($sModule))) {
self::markTestSkipped("Test skipped: module '$sModule' is not present");
}
}
}