38 lines
950 B
PHP
38 lines
950 B
PHP
<?php
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
use PSC\Library\Calc\Graph\Graph;
|
|
use PSC\Library\Calc\Model\Part;
|
|
use PSC\Library\Calc\Model\PartType;
|
|
|
|
use function PHPUnit\Framework\assertSame;
|
|
use function PHPUnit\Framework\assertTrue;
|
|
|
|
class SimpleTest extends TestCase
|
|
{
|
|
private Graph $graph;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->graph = new Graph(
|
|
file_get_contents(__DIR__ . '/formel.txt'),
|
|
file_get_contents(__DIR__ . '/parameter.txt'),
|
|
);
|
|
}
|
|
|
|
public function testGraph(): void
|
|
{
|
|
$this->graph->addCalcFormel(new Part(
|
|
type: PartType::CalcFormel,
|
|
name: 'test1',
|
|
unParsed: '$Ftest1$F+$Ftest2$F+10',
|
|
));
|
|
|
|
assertTrue($this->graph->build());
|
|
assertSame(5610, $this->graph->getSum());
|
|
|
|
// $xmlString = $this->graph->generateSVGGraph();
|
|
// file_put_contents('my-image.svg', $xmlString);
|
|
}
|
|
}
|