mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-23 17:22:18 +02:00
N°9618 - Be able to write comment in MyModuleSettings
N°9618 - Be able to write comment in MyModuleSettings
This commit is contained in:
@@ -72,7 +72,6 @@ class ConfigTest extends ItopTestCase
|
||||
'sExpectedContains' => "'app_root_url' => 'http://%server(SERVER_NAME)?:localhost%/itop/iTop/'",
|
||||
'aChanges' => [],
|
||||
],
|
||||
|
||||
'preserve set same value' => [
|
||||
'sConfigFile' => __DIR__.'/ConfigTest/config-itop-var.php',
|
||||
'sExpectedContains' => "'app_root_url' => 'http://' . (isset(\$_SERVER['SERVER_NAME']) ? \$_SERVER['SERVER_NAME'] : 'localhost') . '/itop/iTop/'",
|
||||
@@ -91,4 +90,21 @@ class ConfigTest extends ItopTestCase
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function testPreserveModuleSettingsOnWriteToFile()
|
||||
{
|
||||
$sTmpFile = tempnam(sys_get_temp_dir(), "target");
|
||||
|
||||
$sConfigFile = __DIR__.'/ConfigTest/config-itop-modulesetting.php';
|
||||
$oConfig = new Config($sConfigFile);
|
||||
$oConfig->WriteToFile($sTmpFile);
|
||||
|
||||
$this->assertFileExists($sTmpFile);
|
||||
$this->assertEquals($this->GetModuleSettingSection($sConfigFile), $this->GetModuleSettingSection($sTmpFile));
|
||||
}
|
||||
|
||||
private function GetModuleSettingSection(string $sFilePath) : string {
|
||||
preg_match('/\$MyModuleSettings[\w\W]*\/\*\*/m', file_get_contents($sFilePath), $aMatches);
|
||||
return preg_replace(['/[ ]+/', '/[ ]+/'],[' ', ' '], $aMatches[0]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* Configuration file, generated for the unit tests
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
$MySettings = [
|
||||
];
|
||||
|
||||
/**
|
||||
*
|
||||
* Modules specific settings
|
||||
*
|
||||
*/
|
||||
$MyModuleSettings = array(
|
||||
'combodo-hybridauth' => array (
|
||||
//debug to add traces...
|
||||
'debug' => false,
|
||||
'providers' => array (
|
||||
'Keycloak' =>
|
||||
/*
|
||||
ga
|
||||
bu
|
||||
zo meu
|
||||
*/
|
||||
array (
|
||||
'keys' =>
|
||||
array (
|
||||
/**
|
||||
* sha
|
||||
*
|
||||
* dok
|
||||
*/
|
||||
'id' => 'my-clientid',
|
||||
'secret' => 'my-secret',
|
||||
),
|
||||
'enabled' => false,
|
||||
),
|
||||
//url to access IdP
|
||||
'url' => 'keycloak_url',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
*
|
||||
* Data model modules to be loaded. Names are specified as relative paths
|
||||
*
|
||||
*/
|
||||
$MyModules = [
|
||||
];
|
||||
Reference in New Issue
Block a user