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 testOptionAuswahl330(): void { $this->assertSame('30', $this->engine->getArticle()->getOptionById('auswahl3')->getRawValue()); } public function testOptionAuswahl331(): void { $this->engine->setVariable('auswahl2', 21); $this->engine->calc(); $this->assertSame('31', $this->engine->getArticle()->getOptionById('auswahl3')->getRawValue()); } public function testOptionCheckbox(): void { $this->engine->setVariable('checkboxen1', [1,2]); $this->engine->calc(); self::assertTrue($this->engine->getArticle()->getOptionById('checkboxen1')->getOptions()[0]->isSelected()); self::assertTrue($this->engine->getArticle()->getOptionById('checkboxen1')->getOptions()[1]->isSelected()); $this->engine->setVariable('checkboxen1', [2]); self::assertFalse($this->engine->getArticle()->getOptionById('checkboxen1')->getOptions()[0]->isSelected()); self::assertTrue($this->engine->getArticle()->getOptionById('checkboxen1')->getOptions()[1]->isSelected()); } }