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(): void { $this->engine = null; } public function tesDefault(): void { $this->engine->calc(); $this->assertSame("11", $this->engine->getArticle()->getOptionById('set1')->getSelectedOption()->getId()); $this->assertSame("21", $this->engine->getArticle()->getOptionById('set2')->getSelectedOption()->getId()); $this->assertSame("31", $this->engine->getArticle()->getOptionById('set3')->getSelectedOption()->getId()); } public function tesChangeDefault(): void { $this->engine->calc(); $this->assertSame("11", $this->engine->getArticle()->getOptionById('set1')->getSelectedOption()->getId()); $this->assertSame("21", $this->engine->getArticle()->getOptionById('set2')->getSelectedOption()->getId()); $this->assertSame("31", $this->engine->getArticle()->getOptionById('set3')->getSelectedOption()->getId()); $this->assertSame("41", $this->engine->getArticle()->getOptionById('set4')->getSelectedOption()->getId()); $this->engine->setVariable('auflage', 2000); $this->engine->calc(); $this->assertSame("12", $this->engine->getArticle()->getOptionById('set1')->getSelectedOption()->getId()); $this->assertSame("22", $this->engine->getArticle()->getOptionById('set2')->getSelectedOption()->getId()); $this->assertSame("32", $this->engine->getArticle()->getOptionById('set3')->getSelectedOption()->getId()); $this->assertSame("42", $this->engine->getArticle()->getOptionById('set4')->getSelectedOption()->getId()); } public function testPrice(): void { $this->engine->calc(); $this->assertSame(101900.0, $this->engine->getPrice()); var_dump($this->engine->getCalcGraph()); } }