diff --git a/src/Calc/Calc.php b/src/Calc/Calc.php
index c325a2d..219cb6a 100644
--- a/src/Calc/Calc.php
+++ b/src/Calc/Calc.php
@@ -125,7 +125,11 @@ class Calc
$p = 0;
$formel = str_replace("tonumber", '$this->toNumber', $formel);
- eval('@$p = ' . $formel . ';');
+ try {
+ eval('@$p = ' . $formel . ';');
+ }catch (\Throwable $e) {
+ $p = 0;
+ }
//echo $option->getId(). ' / '.$formel . ' / '.$p.' / '.PHP_EOL.PHP_EOL;
if($p > 0 || $p < 0) {
$gesamt += $p;
diff --git a/tests/Customer/H/CalcTest.php b/tests/Customer/H/CalcTest.php
new file mode 100644
index 0000000..c06e32b
--- /dev/null
+++ b/tests/Customer/H/CalcTest.php
@@ -0,0 +1,55 @@
+parse(simplexml_load_string(file_get_contents(__DIR__ . '/papierContainer.xml')));
+
+ $this->engine = new Engine();
+ $this->engine->setPaperContainer($paperContainer);
+ $this->engine->setPaperRepository($repository);
+ $this->engine->setFormulas(file_get_contents(__DIR__ . '/formels.txt'));
+ $this->engine->setParameters(file_get_contents(__DIR__ . '/parameters.txt'));
+ $this->engine->setTemplates(file_get_contents(__DIR__ . '/calcTemplates.xml'));
+
+ $this->engine->loadString(file_get_contents(__DIR__ . '/calc.xml'));
+
+ }
+
+ public function tearDown()
+ {
+ $this->engine = null;
+ }
+
+ public function testIfDefaultPriceIsOk()
+ {
+ $this->assertEquals(33 , $this->engine->getPrice());
+ }
+
+ public function testIfDisplayValues()
+ {
+ $this->assertEquals(33 , $this->engine->getPrice());
+ $this->assertCount(0 , $this->engine->getDisplayVariables());
+ }
+
+ public function testIfAjaxValues()
+ {
+ $this->engine->setVariable('sap_plugin', 1);
+ $this->assertEquals(258 , $this->engine->getPrice());
+ $this->assertCount(6 , $this->engine->getAjaxVariables());
+ }
+}
\ No newline at end of file
diff --git a/tests/Customer/H/calc.xml b/tests/Customer/H/calc.xml
new file mode 100644
index 0000000..ff1d3cd
--- /dev/null
+++ b/tests/Customer/H/calc.xml
@@ -0,0 +1,494 @@
+
+
+
+ Export Filing CHIEF
+ Testkalkulation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ // Anzahl User nicht mehr preisrelevant, daher Default=1 und Hidden
+
+
+
+
+
+ //Diese Option gibt es für Deutschland noch nicht!!
+ //Zum Start noch nicht verfügbar
+
+
+
+
+ // Neue Option RoRo
+
+
+
+ // Neue Option LowRisk
+
+
+
+
+
+
+
+ //Diese Option gibt es NUR GEGEN Aufpreis; Projektarbeit, deshalb keine Bestellung möglich
+
+
+ //Diese Option gibt es OHNE Aufpreis; Projektarbeit, deshalb keine Bestellung möglich
+
+
+
+
+ // Wenn dieses Ergebnis >0 ist, dann kann man nicht bestellen. Das könnte für das Template verwendet werden
+
+
+
+ // Ansicht Auswertung RoRo und LowRisk
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ //Berechnung des Tarifmodells - Nach der Berechnung des Monatspreises. Wird über Javascript im Shop ausgeblendet!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/Customer/H/calcTemplates.xml b/tests/Customer/H/calcTemplates.xml
new file mode 100644
index 0000000..b3f7d62
--- /dev/null
+++ b/tests/Customer/H/calcTemplates.xml
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/tests/Customer/H/formels.txt b/tests/Customer/H/formels.txt
new file mode 100644
index 0000000..e69de29
diff --git a/tests/Customer/H/papierContainer.xml b/tests/Customer/H/papierContainer.xml
new file mode 100644
index 0000000..8ec6de3
--- /dev/null
+++ b/tests/Customer/H/papierContainer.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/tests/Customer/H/parameters.txt b/tests/Customer/H/parameters.txt
new file mode 100644
index 0000000..af63262
--- /dev/null
+++ b/tests/Customer/H/parameters.txt
@@ -0,0 +1,77 @@
+// AEB Exportfilling
+
+//Tairfe pro Monat Export
+$tarif_starter=33;
+$tarif_basic=92;
+$tarif_business=356;
+$tarif_enterprise=1843;
+
+//Tairfe pro Monat Export Brexit
+$tarif_starter_brexit=33;
+$tarif_basic_brexit=92;
+$tarif_business_brexit=356;
+$tarif_enterprise_brexit=1843;
+
+
+//Schwellwerte für Tarifwechsel Export
+//bis jetzt nich verwendbar in Grenzen
+$schwellwert_starter=158;
+$schwellwert_basic=1374;
+$schwellwert_business=13749;
+$schwellwert_enterprise_ab=13750;
+
+//enthaltene Ausfuhren Export
+$enthaltene_ausfuhren_starter=25;
+$enthaltene_ausfuhren_basic=250;
+$enthaltene_ausfuhren_business=2500;
+$enthaltene_ausfuhren_enterprise=25000;
+
+//enthaltene Ausfuhren Export Brexit
+$enthaltene_ausfuhren_starter_brexit=50;
+$enthaltene_ausfuhren_basic_brexit=250;
+$enthaltene_ausfuhren_business_brexit=2500;
+$enthaltene_ausfuhren_enterprise_brexit=25000;
+
+// Setup-Kosten
+$setup_exportfilling=600;
+
+//SAP Setup einmalig Export filing Chief
+$sap_export_filing_chief_ecc=5700;
+$sap_export_filing_chief_hana=7600;
+
+//SAP monatlich Export filing Chief
+$sap_export_filing_chief_monatlich=225;
+
+// Setup-Kosten Export Brexit
+$setup_export_starter_brexit=0;
+$setup_export_basic_brexit=0;
+$setup_export_business_brexit=0;
+$setup_export_enterprise_brexit=600;
+
+//Kosten zusätzliche Ausfuhren Export
+$kosten_ausfuhren_starter=3.60;
+$kosten_ausfuhren_basic=2.82;
+$kosten_ausfuhren_business=1.59;
+$kosten_ausfuhren_enterprise=0.88;
+
+//Kosten zusätzliche Ausfuhren Export Brexit
+$kosten_ausfuhren_starter_brexit=3.60;
+$kosten_ausfuhren_basic_brexit=2.82;
+$kosten_ausfuhren_business_brexit=1.59;
+$kosten_ausfuhren_enterprise_brexit=0.88;
+
+//AEB Importfilling
+//Tarife pro Monat Import
+$tarif_basic_import=92;
+$tarif_business_import=626;
+$tarif_enterprise_import=1843;
+
+//enthaltene Ausfuhren Import
+$enthaltene_ausfuhren_basic_import=100;
+$enthaltene_ausfuhren_business_import=2500;
+$enthaltene_ausfuhren_enterprise_import=10000;
+
+//Kosten zusätzliche Ausfuhren Import
+$kosten_ausfuhren_basic_import=5.34;
+$kosten_ausfuhren_business_import=3.89;
+$kosten_ausfuhren_enterprise_import=2.21;
\ No newline at end of file
diff --git a/tests/General/LoadTest.php b/tests/General/LoadTest.php
index 5322cf4..d384a42 100644
--- a/tests/General/LoadTest.php
+++ b/tests/General/LoadTest.php
@@ -12,4 +12,11 @@ class LoadTest extends \PHPUnit_Framework_TestCase
$this->assertTrue($parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml')));
}
+ public function testWrongEval()
+ {
+ $parser = new Engine();
+ $parser->loadString(file_get_contents(__DIR__ .'/../TestFiles/General/simple.xml'));
+ $this->assertEquals(0, $parser->getPrice());
+ }
+
}
\ No newline at end of file
diff --git a/tests/TestFiles/General/simple.xml b/tests/TestFiles/General/simple.xml
index df1fc05..9d90583 100755
--- a/tests/TestFiles/General/simple.xml
+++ b/tests/TestFiles/General/simple.xml
@@ -4,7 +4,11 @@
Blocks A5 25blatt geleimt
kein
-
+