calc/tests/Json/ParserTest.php
2025-07-25 10:55:46 +02:00

27 lines
773 B
PHP

<?php
namespace PSC\Library\Calc\Tests\Json;
use PHPUnit\Framework\TestCase;
use PSC\Library\Calc\Engine;
use PSC\Library\Calc\Option\Parser\Row;
use Spatie\ArrayToXml\ArrayToXml;
class ParserTest extends TestCase
{
public function testFromJson()
{
$engine1 = new Engine();
self::assertTrue($engine1->loadJson(file_get_contents(__DIR__ . '/fromRowCol.json')));
self::assertXmlStringEqualsXmlFile(__DIR__ . '/fromRowCol.xml', $engine1->generateXML());
}
public function testFromXML()
{
$engine1 = new Engine();
self::assertTrue($engine1->loadString(file_get_contents(__DIR__ . '/fromRowCol.xml')));
self::assertJsonStringEqualsJsonFile(__DIR__ . '/fromRowCol.json', $engine1->generateJson());
}
}