Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions setup/wizardsteps/WizStepModulesChoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -758,12 +758,11 @@ public function ComputeChoiceFlags(array $aChoice, string $sChoiceId, array $aSe
if ($bMissingFromDisk) {
$bDisabled = true;
$bChecked = false;
} elseif ($bDependencyIssue) {
$bDisabled = true;
$bChecked = false;
} elseif ($bMandatory) {
$bDisabled = true;
$bChecked = true;
} elseif ($bDependencyIssue) {
$bDisabled = !$bDisableUninstallCheck;
} elseif ($bInstalled && !$bCanBeUninstalled && !$bDisableUninstallCheck) {
$bChecked = true;
$bDisabled = true;
Expand Down Expand Up @@ -813,6 +812,9 @@ public function DisplayOptions($oPage, $aStepInfo, $aSelectedComponents, $aDefau

if ($aFlags['disabled'] && !$aFlags['checked'] && !$bDisableUninstallCheck && (!$aFlags['uninstallable'] || $aFlags['mandatory'])) {
$this->bCanMoveForward = false;//Disable "Next"
} elseif (!$bDisableUninstallCheck && $aFlags['dependency_issue']) {
Comment thread
Lenaick marked this conversation as resolved.
//If there is a dependency issue, the user cannot move forward without forced uninstall
$this->bCanMoveForward = false;
}

$this->DisplayChoice($oPage, $aChoice, $aSelectedComponents, $aDefaults, $sChoiceId, $sChoiceId, $aFlags);
Expand Down
112 changes: 110 additions & 2 deletions tests/php-unit-tests/unitary-tests/setup/WizStepModulesChoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public function ProviderComputeChoiceFlags()
'mandatory' => false,
],
],
'A non installed extension with missing dependencies should be not checked and disabled' => [
'A non installed and non mandatory extension with missing dependencies and without force uninstall should be not checked and disabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => false,
Expand All @@ -421,7 +421,7 @@ public function ProviderComputeChoiceFlags()
'mandatory' => false,
],
],
'An installed extension with missing dependencies should be not checked and disabled' => [
'An installed non mandatory extension with missing dependencies and without force uninstall should be not checked and disabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => true,
Expand All @@ -448,6 +448,114 @@ public function ProviderComputeChoiceFlags()
'mandatory' => false,
],
],
'A non installed and non mandatory extension with missing dependencies and force uninstall should be not checked and enabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => false,
'missing_dependencies' => [
'itop-ext1-1',
],
],
],
'aWizardStepDefinition' => [
'extension_code' => 'itop-ext1',
'mandatory' => false,
'uninstallable' => true,
'missing_dependencies' => true,
],
'bCurrentSelected' => false,
'bDisableUninstallChecks' => true,
'aExpectedFlags' => [
'uninstallable' => true,
'missing' => false,
'installed' => false,
'disabled' => false,
'checked' => false,
'dependency_issue' => true,
'mandatory' => false,
],
],
'An installed non mandatory extension with missing dependencies and force uninstall should be not checked and enabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => true,
'missing_dependencies' => [
'itop-ext1-1',
],
],
],
'aWizardStepDefinition' => [
'extension_code' => 'itop-ext1',
'mandatory' => false,
'uninstallable' => true,
'missing_dependencies' => true,
],
'bCurrentSelected' => false,
'bDisableUninstallChecks' => true,
'aExpectedFlags' => [
'uninstallable' => true,
'missing' => false,
'installed' => true,
'disabled' => false,
'checked' => false,
'dependency_issue' => true,
'mandatory' => false,
],
],
'An installed mandatory extension with missing dependencies and without force uninstall should be checked and disabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => true,
'missing_dependencies' => [
'itop-ext1-1',
],
],
],
'aWizardStepDefinition' => [
'extension_code' => 'itop-ext1',
'mandatory' => true,
'uninstallable' => true,
'missing_dependencies' => true,
],
'bCurrentSelected' => false,
'bDisableUninstallChecks' => true,
'aExpectedFlags' => [
'uninstallable' => true,
'missing' => false,
'installed' => true,
'disabled' => true,
'checked' => true,
'dependency_issue' => true,
'mandatory' => true,
],
],
'An non installed mandatory extension with missing dependencies and without force uninstall should be checked and disabled' => [
'aExtensionsOnDiskOrDb' => [
'itop-ext1' => [
'installed' => false,
'missing_dependencies' => [
'itop-ext1-1',
],
],
],
'aWizardStepDefinition' => [
'extension_code' => 'itop-ext1',
'mandatory' => true,
'uninstallable' => true,
'missing_dependencies' => true,
],
'bCurrentSelected' => false,
'bDisableUninstallChecks' => true,
'aExpectedFlags' => [
'uninstallable' => true,
'missing' => false,
'installed' => false,
'disabled' => true,
'checked' => true,
'dependency_issue' => true,
'mandatory' => true,
],
],
];
}

Expand Down