diff --git a/tests/before_script.sh b/tests/before_script.sh index 4a835f1d..b3d4ea74 100755 --- a/tests/before_script.sh +++ b/tests/before_script.sh @@ -34,18 +34,20 @@ mkdir plugins/fusioninventory && git clone --depth=35 $FI_SOURCE -b $FI_BRANCH p IFS=/ read -a repo <<< $TRAVIS_REPO_SLUG mv ../${repo[1]} plugins/flyvemdm +# patch settings +PATCH_ARGS="-p1 -N --batch" + # patch Fusion Inventory when needed cd plugins/fusioninventory -if [[ $FI_BRANCH == "master" ]] ; then patch -p1 --batch < ../flyvemdm/tests/patches/fusioninventory/fi-raise-max-version.patch; fi -if [[ $FI_BRANCH == "master" ]] ; then patch -p1 --batch < ../flyvemdm/tests/patches/fusioninventory/compat-glpi-9-3-2.diff; fi -if [[ $FI_BRANCH == "glpi9.3" ]] ; then patch -p1 --batch < ../flyvemdm/tests/patches/fusioninventory/compat-glpi-9-3-2.diff; fi +if [[ $FI_BRANCH == "master" ]] ; then patch $PATCH_ARGS < ../flyvemdm/tests/patches/fusioninventory/fi-raise-max-version.patch; fi +if [[ $FI_BRANCH == "master" ]] ; then patch $PATCH_ARGS < ../flyvemdm/tests/patches/fusioninventory/compat-glpi-9-3-2.diff; fi +if [[ $FI_BRANCH == "glpi9.3" ]] ; then patch $PATCH_ARGS < ../flyvemdm/tests/patches/fusioninventory/compat-glpi-9-3-2.diff; fi cd ../.. # patch GLPI when needed -# if [[ $GLPI_BRANCH == "9.2.1" ]] ; then patch -p1 --batch < plugins/flyvemdm/tests/patches/glpi/10f8dabfc5e20bb5a4e7d4ba4b93706871156a8a.diff; fi # prepare plugin to test cd plugins/flyvemdm -if [[ $GLPI_BRANCH == "master" ]] ; then patch -p1 --batch < tests/patches/allow-test-on-master-branch.patch; fi +if [[ $GLPI_BRANCH == "master" ]] ; then patch $PATCH_ARGS < tests/patches/allow-test-on-master-branch.patch; fi composer install --no-interaction diff --git a/tools/cli_install.php b/tools/cli_install.php index 618681b5..1059fb55 100644 --- a/tools/cli_install.php +++ b/tools/cli_install.php @@ -151,6 +151,17 @@ $plugin = new Plugin(); +// Check plugin's requirements +try { + if (!$plugin->checkVersions('flyvemdm')) { + echo PHP_EOL; + exit(1); + } +} catch (LogicException $e) { + echo $e->getMessage(); + exit(2); +} + // Install the plugin $plugin->getFromDBbyDir("flyvemdm"); print("Installing Plugin Id: " . $plugin->fields['id'] . " version " . $plugin->fields['version'] . "\n");