mirror of
https://github.com/Combodo/iTop.git
synced 2026-10-05 16:09:17 +02:00
Compare commits
3 Commits
issue/6073
...
3.3.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e1bf80b9f | ||
|
|
2ac4229ee0 | ||
|
|
e6d485855e |
@@ -61,7 +61,7 @@ foreach ($aTcpdfFontsDirContent as $sTcpdfFontResourceName) {
|
||||
* 2) Then adding the DroidSansFallback font (useful for CJK data for example)
|
||||
*/
|
||||
echo $sCurrentScriptFileName.": ---2) Copying font files to TCPDF ($sTcPdfFontsFolder)...\n";
|
||||
$aFontFilesToCopy = glob(__DIR__.'\droidsansfallback.*');
|
||||
$aFontFilesToCopy = glob(__DIR__.DIRECTORY_SEPARATOR.'droidsansfallback.*');
|
||||
foreach ($aFontFilesToCopy as $sFontFileToCopy) {
|
||||
$sFontFileName = basename($sFontFileToCopy);
|
||||
echo $sCurrentScriptFileName.': copying '.$sFontFileName."\n";
|
||||
|
||||
BIN
lib/tecnickcom/tcpdf/fonts/droidsansfallback.ctg.z
Normal file
BIN
lib/tecnickcom/tcpdf/fonts/droidsansfallback.ctg.z
Normal file
Binary file not shown.
2975
lib/tecnickcom/tcpdf/fonts/droidsansfallback.php
Normal file
2975
lib/tecnickcom/tcpdf/fonts/droidsansfallback.php
Normal file
File diff suppressed because it is too large
Load Diff
BIN
lib/tecnickcom/tcpdf/fonts/droidsansfallback.z
Normal file
BIN
lib/tecnickcom/tcpdf/fonts/droidsansfallback.z
Normal file
Binary file not shown.
@@ -1670,20 +1670,7 @@ JS
|
||||
$oExtensionsMap = iTopExtensionsMap::GetExtensionsMap($oWizard->GetParameter('target_env', ITOP_DEFAULT_ENV));
|
||||
$oExtensionsMap->DeclareExtensionAsRemoved($aRemovedExtensionCodes);
|
||||
|
||||
$aAvailableModules = $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
|
||||
|
||||
$bRemoteExtensionsShouldBeMandatory = !$oWizard->GetParameter('force-uninstall', false);
|
||||
if ($bRemoteExtensionsShouldBeMandatory) {
|
||||
foreach ($aAvailableModules as $key => $aModule) {
|
||||
$bIsExtra = (array_key_exists('root_dir', $aModule) && (strpos($aModule['root_dir'], $sExtraDir) !== false)); // Some modules (root, datamodel) have no 'root_dir'
|
||||
if ($bIsExtra) {
|
||||
// Modules in data/production-modules/ are considered as mandatory and always installed
|
||||
$aAvailableModules[$key]['visible'] = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $aAvailableModules;
|
||||
return $oProductionEnv->AnalyzeInstallation($oConfig, $aDirsToScan, $bAbortOnMissingDependency, $aModulesToLoad);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* @copyright Copyright (C) 2010-2026 Combodo SAS
|
||||
* @license http://opensource.org/licenses/AGPL-3.0
|
||||
*/
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\DotMake\Dependencies\Composer\Tcpdf;
|
||||
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
|
||||
/**
|
||||
* @coversNothing
|
||||
*/
|
||||
class TcpdfUpdateFontsTest extends ItopTestCase
|
||||
{
|
||||
public function testThatDroidSansFallbackFilesAreCopiedToTcpdfFontsFolderAfterLibraryUpdate(): void
|
||||
{
|
||||
$sSourcePattern = APPROOT
|
||||
.'.make'.DIRECTORY_SEPARATOR.'dependencies'.DIRECTORY_SEPARATOR.'composer'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'droidsansfallback.*';
|
||||
$aSourceFiles = glob($sSourcePattern);
|
||||
$this->assertIsArray($aSourceFiles, 'Unable to read source TCPDF custom font files.');
|
||||
$this->assertNotEmpty($aSourceFiles, 'No source files found for pattern droidsansfallback.*');
|
||||
|
||||
foreach ($aSourceFiles as $sSourceFilePath) {
|
||||
$sFontFileName = basename($sSourceFilePath);
|
||||
$sDestinationFilePath = APPROOT
|
||||
.'lib'.DIRECTORY_SEPARATOR.'tecnickcom'.DIRECTORY_SEPARATOR.'tcpdf'.DIRECTORY_SEPARATOR.'fonts'.DIRECTORY_SEPARATOR.$sFontFileName;
|
||||
|
||||
$this->assertFileExists($sDestinationFilePath, "Missing copied font file: {$sFontFileName}");
|
||||
$this->assertSame(
|
||||
hash_file('sha256', $sSourceFilePath),
|
||||
hash_file('sha256', $sDestinationFilePath),
|
||||
"Copied font file content mismatch: {$sFontFileName}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,9 +2,13 @@
|
||||
|
||||
namespace Combodo\iTop\Test\UnitTest\Setup;
|
||||
|
||||
use AnalyzeInstallation;
|
||||
use CheckResult;
|
||||
use Combodo\iTop\Setup\FeatureRemoval\ModelReflectionSerializer;
|
||||
use Combodo\iTop\Test\UnitTest\ItopTestCase;
|
||||
use Config;
|
||||
use ModuleDiscovery;
|
||||
use WizardController;
|
||||
use SetupUtils;
|
||||
|
||||
/**
|
||||
@@ -28,6 +32,13 @@ class SetupUtilsTest extends ItopTestCase
|
||||
|
||||
$this->RequireOnceItopFile('setup/setuputils.class.inc.php');
|
||||
$this->RequireOnceItopFile('setup/setuppage.class.inc.php');
|
||||
$this->RequireOnceItopFile('setup/wizardcontroller.class.inc.php');
|
||||
}
|
||||
|
||||
protected function tearDown(): void
|
||||
{
|
||||
parent::tearDown();
|
||||
ModuleDiscovery::ResetCache();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,6 +230,30 @@ OUTPUT;
|
||||
$this->ValidateCheckResults($expected, $aRes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug N°10045
|
||||
*/
|
||||
public function testAnalyzeInstallationDoesNotAutomaticallySetModulesInProductionModulesVisibilityToFalse()
|
||||
{
|
||||
$this->RequireOnceItopFile('setup/moduleinstallation/AnalyzeInstallation.php');
|
||||
$this->SetNonPublicProperty(AnalyzeInstallation::GetInstance(), 'aAvailableModules', null);
|
||||
|
||||
$sRemoteEnv = 'production-temp';
|
||||
$sExtraDir = \utils::GetDataPath().$sRemoteEnv.'-modules/';
|
||||
$sExtraModuleName = 'extra-module';
|
||||
|
||||
$this->createModule($sExtraDir, $sExtraModuleName, '1.0.0');
|
||||
|
||||
$oWizard = new WizardController('WizStepWelcome');
|
||||
$oWizard->SetParameter('source_dir', APPROOT.'datamodels/2.x');
|
||||
$oWizard->SetParameter('remote_env', $sRemoteEnv);
|
||||
|
||||
$aModules = SetupUtils::AnalyzeInstallation($oWizard);
|
||||
|
||||
$this->assertContains($sExtraModuleName, array_keys($aModules), 'Module discovery should have found the extra module');
|
||||
$this->assertTrue($aModules[$sExtraModuleName]['visible'], 'AnalyzeInstallation should not have automatically set the extra module visibility to false');
|
||||
}
|
||||
|
||||
private function ValidateCheckResults(array $expected, array $aActualCheckResults)
|
||||
{
|
||||
$aActual = [];
|
||||
@@ -232,4 +267,37 @@ OUTPUT;
|
||||
self::assertEquals($expected, $aActual);
|
||||
}
|
||||
|
||||
protected function createModule($sDirectory, $sModuleName, $sModuleVersion, $bMandatory = false, $bVisible = true)
|
||||
{
|
||||
$sModuleDir = $sDirectory.'/'.$sModuleName;
|
||||
SetupUtils::builddir($sModuleDir);
|
||||
$this->aFileToClean[] = $sDirectory;
|
||||
|
||||
$sModuleFileName = $sModuleDir.'/module.'.$sModuleName.'.php';
|
||||
|
||||
$sMandatory = var_export($bMandatory, true);
|
||||
$sVisible = var_export($bVisible, true);
|
||||
file_put_contents(
|
||||
$sModuleFileName,
|
||||
<<<PHP
|
||||
<?php
|
||||
SetupWebPage::AddModule(
|
||||
__FILE__,
|
||||
"$sModuleName/$sModuleVersion",
|
||||
[
|
||||
'label' => "$sModuleName",
|
||||
'dependencies' => [],
|
||||
'mandatory' => $sMandatory,
|
||||
'visible' => $sVisible,
|
||||
'datamodel' => [],
|
||||
'data.struct' => [],
|
||||
'data.sample' => [],
|
||||
'doc.manual_setup' => '',
|
||||
'doc.more_information' => '',
|
||||
]
|
||||
);
|
||||
PHP
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user