From 7c1adb2aba06b99e550b9354a184c0a1684d394f Mon Sep 17 00:00:00 2001 From: Thomas Peterson Date: Tue, 28 Jun 2022 11:53:11 +0200 Subject: [PATCH] Fix Calc --- src/Calc/Valid.php | 4 ---- tests/Customer/P/CalcTest.php | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/Calc/Valid.php b/src/Calc/Valid.php index 49326f4..d236848 100644 --- a/src/Calc/Valid.php +++ b/src/Calc/Valid.php @@ -42,14 +42,10 @@ class Valid foreach($this->article->getOptions() as $option) { if($option instanceof Input) { if($option->getMaxValue() && $option->getMaxValue() <= $option->getRawValue()) { - $option->setIsValid(false); $option->addValidationError(new Max($option->getRawValue(), $option->getMaxValue())); - continue; } if($option->getMinValue() && $option->getMinValue() >= $option->getRawValue()) { - $option->setIsValid(false); $option->addValidationError(new Min($option->getRawValue(), $option->getMinValue())); - continue; } } if($option instanceof Select|| $option instanceof Checkbox) { diff --git a/tests/Customer/P/CalcTest.php b/tests/Customer/P/CalcTest.php index bb11806..99a5bcb 100644 --- a/tests/Customer/P/CalcTest.php +++ b/tests/Customer/P/CalcTest.php @@ -53,7 +53,7 @@ class CalcTest extends TestCase $this->engine->setVariable('breite_frei', 600); $this->engine->calc(); - $this->assertFalse($article->getOptionById('breite_frei')->isValid()); + $this->assertTrue($article->getOptionById('breite_frei')->isValid()); $this->assertEquals(1, count($article->getOptionById('breite_frei')->getValidationErrors())); $this->assertInstanceOf(Max::class, $article->getOptionById('breite_frei')->getValidationErrors()->first()); } @@ -64,7 +64,7 @@ class CalcTest extends TestCase $this->engine->setVariable('breite_frei', 10); $this->engine->calc(); - $this->assertFalse($article->getOptionById('breite_frei')->isValid()); + $this->assertTrue($article->getOptionById('breite_frei')->isValid()); $this->assertEquals(1, count($article->getOptionById('breite_frei')->getValidationErrors())); $this->assertInstanceOf(Min::class, $article->getOptionById('breite_frei')->getValidationErrors()->first()); }