diff --git a/src/Engine.php b/src/Engine.php index 9ed1171..f71d2b8 100644 --- a/src/Engine.php +++ b/src/Engine.php @@ -206,6 +206,10 @@ class Engine if(!isset($this->variables[$option->getId()]) && $option->getDefault() !== null && !$option instanceof Text) { $this->variables[$option->getId()] = $option->getDefault(); } + + if(isset($this->variables[$option->getId()])) { + $option->setValue($this->variables[$option->getId()]); + } } // Check if Option is valid diff --git a/tests/Calc/OptionsRemoveTest.php b/tests/Calc/OptionsRemoveTest.php index 0b9f57c..bb42e8d 100644 --- a/tests/Calc/OptionsRemoveTest.php +++ b/tests/Calc/OptionsRemoveTest.php @@ -53,6 +53,8 @@ class OptionsRemoveTest extends \PHPUnit_Framework_TestCase $this->engine->setVariables(['gebyn' => 2]); $this->engine->calc('test1'); + $this->assertEquals(2, $article->getOptionById('gebyn')->getValue()); + $option = $article->getOptionById('gebwert'); $this->assertFalse($option->isValid());