This commit is contained in:
Thomas Peterson 2018-11-23 13:10:42 +01:00
parent e3df96216a
commit fa9993e94b
2 changed files with 6 additions and 0 deletions

View File

@ -206,6 +206,10 @@ class Engine
if(!isset($this->variables[$option->getId()]) && $option->getDefault() !== null && !$option instanceof Text) { if(!isset($this->variables[$option->getId()]) && $option->getDefault() !== null && !$option instanceof Text) {
$this->variables[$option->getId()] = $option->getDefault(); $this->variables[$option->getId()] = $option->getDefault();
} }
if(isset($this->variables[$option->getId()])) {
$option->setValue($this->variables[$option->getId()]);
}
} }
// Check if Option is valid // Check if Option is valid

View File

@ -53,6 +53,8 @@ class OptionsRemoveTest extends \PHPUnit_Framework_TestCase
$this->engine->setVariables(['gebyn' => 2]); $this->engine->setVariables(['gebyn' => 2]);
$this->engine->calc('test1'); $this->engine->calc('test1');
$this->assertEquals(2, $article->getOptionById('gebyn')->getValue());
$option = $article->getOptionById('gebwert'); $option = $article->getOptionById('gebwert');
$this->assertFalse($option->isValid()); $this->assertFalse($option->isValid());