mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
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:
@@ -3,12 +3,19 @@ namespace Combodo\iTop\Test\UnitTest\HubConnector;
|
||||
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
use Combodo\iTop\Test\UnitTest\ItopDataTestCase;
|
||||
use PHPUnit\Framework\SkippedTestCase;
|
||||
|
||||
class AjaxPageTest extends ItopDataTestCase {
|
||||
const USE_TRANSACTION = false;
|
||||
const AUTHENTICATION_TOKEN = '14b5da9d092f84044187421419a0347e7317bc8cd2b486fdda631be06b959269';
|
||||
const AUTHENTICATION_PASSWORD = "tagada-Secret,007";
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->SkipIfModuleNotPresent('itop-hub-connector');
|
||||
parent::setUp();
|
||||
}
|
||||
|
||||
public function testCompileOperation()
|
||||
{
|
||||
// Given
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user