N°9088 Allow extension uninstallation from production-modules folder

This commit is contained in:
Timmy38
2026-03-05 10:33:40 +01:00
committed by GitHub
parent ab691c3ae6
commit f6664862b5
4 changed files with 49 additions and 9 deletions

View File

@@ -3,6 +3,7 @@
namespace Combodo\iTop\Test\UnitTest\Integration;
use Combodo\iTop\Test\UnitTest\ItopTestCase;
use iTopExtension;
use iTopExtensionsMap;
use iTopExtensionsMapFake;
use ModuleDiscovery;
@@ -376,6 +377,44 @@ class WizStepModulesChoiceTest extends ItopTestCase
$this->assertEquals($aExpectedFlags, $aFlags);
}
public function ProviderGetAllExtensionsToDisplayInSetupMandatoryFlag()
{
return [
'A manually added extension should not be mandatory by default' => [
'bExtensionSource' => 'extensions',//iTopExtension::SOURCE_MANUAL
'bDisableUninstallChecks' => false,
'bExpectedMandatory' => false,
],
'A remotely added extension should be mandatory by default' => [
'bExtensionSource' => 'data',//iTopExtension::SOURCE_REMOTE
'bDisableUninstallChecks' => false,
'bExpectedMandatory' => true,
],
'A remotely added extension should not be mandatory by default if uninstall checks has been disabled' => [
'bExtensionSource' => 'data',//iTopExtension::SOURCE_REMOTE
'bDisableUninstallChecks' => true,
'bExpectedMandatory' => false,
],
];
}
/**
* @dataProvider ProviderGetAllExtensionsToDisplayInSetupMandatoryFlag
*/
public function testGetAllExtensionsToDisplayInSetupMandatoryFlag($bExtensionSource, $bDisableUninstallChecks, $bExpectedMandatory)
{
$aExtensionsOnDiskOrDb = [
'itop-ext1' => [
'installed' => true,
'source' => $bExtensionSource,
],
];
$oMap = iTopExtensionsMapFake::createFromArray($aExtensionsOnDiskOrDb);
$aExtensions = $oMap->GetAllExtensionsToDisplayInSetup(false, !$bDisableUninstallChecks);
$this->assertEquals($bExpectedMandatory, $aExtensions['itop-ext1']->bMandatory);
}
public function ProviderGetAddedAndRemovedExtensions()
{
return [