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 {
|
else {
|
||||||
$subKeyword = $parts[1];
|
$subKeyword = $parts[1];
|
||||||
$startIndex = $startIndex + strlen($subKeyword) + 2;
|
$startIndex = $startIndex + strlen($subKeyword) + 2;
|
||||||
|
$option = substr($line, $startIndex);
|
||||||
|
if (empty($option)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// module settings
|
// module settings
|
||||||
if ($keyword == 'modules') {
|
if ($keyword == 'modules') {
|
||||||
$option = substr($line, $startIndex);
|
|
||||||
$this->moduleSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
$this->moduleSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
||||||
}
|
}
|
||||||
// type settings
|
// type settings
|
||||||
if ($keyword == 'types') {
|
if ($keyword == 'types') {
|
||||||
$option = substr($line, $startIndex);
|
|
||||||
$this->typeSettings[$subKeyword] = $option;
|
$this->typeSettings[$subKeyword] = $option;
|
||||||
}
|
}
|
||||||
// tool settings
|
// tool settings
|
||||||
if ($keyword == 'tools') {
|
if ($keyword == 'tools') {
|
||||||
$option = substr($line, $startIndex);
|
|
||||||
$this->toolSettings[$subKeyword] = $option;
|
$this->toolSettings[$subKeyword] = $option;
|
||||||
}
|
}
|
||||||
// job settings
|
// job settings
|
||||||
if ($keyword == 'jobs') {
|
if ($keyword == 'jobs') {
|
||||||
$option = substr($line, $startIndex);
|
|
||||||
$this->jobSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
$this->jobSettings[$subKeyword] = explode(LAMConfig::LINE_SEPARATOR, $option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -699,6 +699,20 @@ class LAMConfigTest extends PHPUnit_Framework_TestCase {
|
||||||
$this->assertFalse(empty($token));
|
$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
|
* Saves the config
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue