Fix Calc
This commit is contained in:
parent
79a15727ac
commit
50450a5723
File diff suppressed because one or more lines are too long
@ -94,7 +94,9 @@ class Valid
|
||||
|
||||
if($option->getDefault() === null && $opt->isValid()) {
|
||||
$option->setDefault($opt->getId());
|
||||
$this->engine->setVariable($option->getId(), $opt->getId());
|
||||
if(!$this->engine->hasVariable($option->getId())) {
|
||||
$this->engine->setVariable($option->getId(), $opt->getId());
|
||||
}
|
||||
}
|
||||
|
||||
if($option instanceof Checkbox) {
|
||||
|
||||
@ -440,6 +440,11 @@ class Engine
|
||||
$this->variables[$var] = $value;
|
||||
}
|
||||
|
||||
public function hasVariable($var): bool
|
||||
{
|
||||
return isset($this->variables[$var]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float
|
||||
*/
|
||||
|
||||
@ -52,4 +52,19 @@ class CalcTest extends TestCase
|
||||
$this->assertTrue($this->engine->getArticle()->getOptionById('defa')->isValid());
|
||||
}
|
||||
|
||||
public function testContainerSelectIgnoreDefaultBinden(): void
|
||||
{
|
||||
$this->engine->setVariable('binden', 'leimes');
|
||||
$this->engine->calc();
|
||||
$this->assertTrue($this->engine->getArticle()->getOptionById('dd')->isValid());
|
||||
$this->assertTrue($this->engine->getArticle()->getOptionById('defa')->isValid());
|
||||
|
||||
$this->engine->setVariable('dd', 'ddleim');
|
||||
$this->engine->calc();
|
||||
|
||||
$this->assertTrue($this->engine->getArticle()->getOptionById('dd')->isValid());
|
||||
$this->assertSame('ddleim', $this->engine->getArticle()->getOptionById('dd')->getRawValue());
|
||||
$this->assertTrue($this->engine->getArticle()->getOptionById('defa')->isValid());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user