diff --git a/src/Option/Type/Select.php b/src/Option/Type/Select.php index b7f817e..406f6e0 100644 --- a/src/Option/Type/Select.php +++ b/src/Option/Type/Select.php @@ -91,4 +91,15 @@ class Select extends Base } } + public function getValidOptions() + { + $tmp = []; + /** @var Opt $opt */ + foreach($this->getOptions() as $opt) { + if($opt->isValid()) $tmp[] = $opt; + } + + return $tmp; + } + } \ No newline at end of file diff --git a/tests/Customer/J/CalcTest.php b/tests/Customer/J/CalcTest.php new file mode 100644 index 0000000..8c3792f --- /dev/null +++ b/tests/Customer/J/CalcTest.php @@ -0,0 +1,48 @@ +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() + { + + /** @var Select $option */ + $option = $this->engine->getArticle()->getOptionById('auflage'); + foreach($option->getValidOptions() as $option) { + $this->assertTrue($option->isValid()); + } + } +} \ No newline at end of file diff --git a/tests/Customer/J/calc.xml b/tests/Customer/J/calc.xml new file mode 100644 index 0000000..8cdafe4 --- /dev/null +++ b/tests/Customer/J/calc.xml @@ -0,0 +1,34 @@ + + + + + Visitenkarten CCEP + Visitenkarten + + + + + + + \ No newline at end of file diff --git a/tests/Customer/J/calcTemplates.xml b/tests/Customer/J/calcTemplates.xml new file mode 100644 index 0000000..093d936 --- /dev/null +++ b/tests/Customer/J/calcTemplates.xml @@ -0,0 +1,2 @@ + + diff --git a/tests/Customer/J/formels.txt b/tests/Customer/J/formels.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/Customer/J/papierContainer.xml b/tests/Customer/J/papierContainer.xml new file mode 100644 index 0000000..8ec6de3 --- /dev/null +++ b/tests/Customer/J/papierContainer.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/tests/Customer/J/parameters.txt b/tests/Customer/J/parameters.txt new file mode 100644 index 0000000..e69de29