mirror of
https://github.com/Combodo/iTop.git
synced 2026-03-05 09:04:19 +01:00
N°2982 - fix delta xml variables not used in themes
This commit is contained in:
@@ -18,12 +18,21 @@ class MFCompilerTest extends ItopTestCase {
|
||||
/** @var \MFCompiler */
|
||||
private $oMFCompiler;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
private $sTmpDir;
|
||||
|
||||
public function setUp() {
|
||||
parent::setUp();
|
||||
require_once(APPROOT.'setup/compiler.class.inc.php');
|
||||
require_once(APPROOT.'setup/modelfactory.class.inc.php');
|
||||
require_once(__DIR__.'/SubMFCompiler.php');
|
||||
|
||||
$this->oMFCompiler = new MFCompiler($this->createMock(\ModelFactory::class), '');
|
||||
$this->sTmpDir = $this->CreateTmpdir();
|
||||
$this->oMFCompiler = new SubMFCompiler($this->createMock(\ModelFactory::class), '');
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
parent::tearDown();
|
||||
$this->RecurseRmdir($this->sTmpDir);
|
||||
}
|
||||
|
||||
public static function Init(){
|
||||
@@ -133,5 +142,46 @@ class MFCompilerTest extends ItopTestCase {
|
||||
];
|
||||
}
|
||||
|
||||
public function testCompileThemes(){
|
||||
$sXmlDataCustoFilePath = realpath(__DIR__ . '/ressources/datamodels/datamodel-branding.xml');
|
||||
$oDom = new MFDocument();
|
||||
$oDom->load($sXmlDataCustoFilePath);
|
||||
|
||||
/** @var \MFElement $oBrandingNode */
|
||||
$oBrandingNode = $oDom->GetNodes('branding')->item(0);
|
||||
|
||||
$this->RecurseMkdir($this->sTmpDir.'/branding/themes/fullmoon/');
|
||||
file_put_contents($this->sTmpDir.'/branding/themes/fullmoon/main.css', "");
|
||||
|
||||
$aImportsPaths = array(
|
||||
APPROOT.'css/',
|
||||
APPROOT.'css/backoffice/main.scss',
|
||||
$this->sTmpDir.'//',
|
||||
);
|
||||
|
||||
|
||||
$aThemeParameters = [
|
||||
'variables' => [
|
||||
'ibo-page-banner--background-color' => '$ibo-color-red-600',
|
||||
'ibo-page-banner--text-color' => '$ibo-color-red-100',
|
||||
'ibo-page-banner--text-content' => '"THIS IS A TEST INSTANCE"',
|
||||
],
|
||||
'imports_variable' => [ 'style2' => 'style2.scss'],
|
||||
'imports_utility' => [ 'style1' => 'style1.scss', 'style3' => 'style3.scss'],
|
||||
'stylesheets' => [
|
||||
"fullmoon" => '../css/backoffice/main.scss',
|
||||
"environment-banner" => '../css/backoffice/themes/page-banner.scss'
|
||||
],
|
||||
];
|
||||
|
||||
$oThemeHandlerService = $this->createMock(\ThemeHandlerService::class);
|
||||
$oThemeHandlerService->expects($this->exactly(1))
|
||||
->method("CompileTheme")
|
||||
->with("fullmoon", true, $this->oMFCompiler->GetCompilationTimeStamp(), $aThemeParameters, $aImportsPaths, $this->sTmpDir . '/');
|
||||
|
||||
|
||||
//CompileTheme($sThemeId, $bSetup = false, $sSetupCompilationTimestamp="", $aThemeParameters = null, $aImportsPaths = null, $sWorkingPath = null)
|
||||
MFCompiler::setThemeHandlerService($oThemeHandlerService);
|
||||
$this->oMFCompiler->CompileThemes($oBrandingNode, $this->sTmpDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user