fixed issues with duplicating empty type and module settings
This commit is contained in:
parent
7264498645
commit
499c6b6a2c
|
@ -643,24 +643,24 @@ class LAMConfig {
|
|||
else {
|
||||
$subKeyword = $parts[1];
|
||||
$startIndex = $startIndex + strlen($subKeyword) + 2;
|
||||
$option = substr($line, $startIndex);
|
||||
if (empty($option)) {
|
||||
continue;
|
||||
}
|
||||
// module settings
|
||||
if ($keyword == 'modules') {
|
||||
$option = substr($line, $startIndex);
|
||||
$this->moduleSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
||||
}
|
||||
// type settings
|
||||
if ($keyword == 'types') {
|
||||
$option = substr($line, $startIndex);
|
||||
$this->typeSettings[$subKeyword] = $option;
|
||||
}
|
||||
// tool settings
|
||||
if ($keyword == 'tools') {
|
||||
$option = substr($line, $startIndex);
|
||||
$this->toolSettings[$subKeyword] = $option;
|
||||
}
|
||||
// job settings
|
||||
if ($keyword == 'jobs') {
|
||||
$option = substr($line, $startIndex);
|
||||
$this->jobSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -699,6 +699,20 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase {
|
|||
$this->assertFalse(empty($token));
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that number of settings stays constant over multiple saves.
|
||||
*/
|
||||
public function testMultiSave() {
|
||||
$sizeModSettings = sizeof($this->lAMConfig->get_moduleSettings());
|
||||
$sizeTypeSettings = sizeof($this->lAMConfig->get_typeSettings());
|
||||
$this->doSave();
|
||||
$this->assertEquals($sizeModSettings, sizeof($this->lAMConfig->get_moduleSettings()));
|
||||
$this->assertEquals($sizeTypeSettings, sizeof($this->lAMConfig->get_typeSettings()));
|
||||
$this->doSave();
|
||||
$this->assertEquals($sizeModSettings, sizeof($this->lAMConfig->get_moduleSettings()));
|
||||
$this->assertEquals($sizeTypeSettings, sizeof($this->lAMConfig->get_typeSettings()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves the config
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue