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_radiobox.xml')); } public function tearDown(): void { $this->engine = null; } public function testCalcDefault(): void { self::assertSame(12.0, $this->engine->getPrice()); self::assertCount(1, $this->engine->getArticle()->getOptionById('radiobox')->getSelectedOptions()); self::assertSame('1', $this->engine->getArticle()->getOptionById('radiobox')->getSelectedOption()->getId()); } public function testCalcOnly2(): void { $this->engine->setVariable('radiobox', 2); $this->assertSame(14.0, $this->engine->getPrice()); self::assertCount(1, $this->engine->getArticle()->getOptionById('radiobox')->getSelectedOptions()); self::assertSame('2', $this->engine->getArticle()->getOptionById('radiobox')->getSelectedOption()->getId()); } }