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 testPrice(): void { $this->engine->calc(); $this->assertSame(1272.34, $this->engine->getPrice()); self::assertCount( 3, $this->engine ->getArticle() ->getOptionById('papier_umschlag') ->getValidOptions(), ); self::assertSame( 60, $this->engine ->getArticle() ->getOptionById('seiten_inhalt') ->getMaxValue(), ); } public function testPapierDbPrice(): void { $this->engine->setVariable('papier_inhalt', 'ct90'); $this->engine->calc(); $this->assertSame(1185.42, $this->engine->getPrice()); self::assertCount( 5, $this->engine ->getArticle() ->getOptionById('papier_umschlag') ->getValidOptions(), ); self::assertSame( 80, $this->engine ->getArticle() ->getOptionById('seiten_inhalt') ->getMaxValue(), ); } }