Exemple #1
0
 public function testGetSegmentStructure()
 {
     $codesXml = __DIR__ . "/../../src/EDI/Mapping/D07A/segments.xml";
     $expected = (include __DIR__ . "/../files/segments.php");
     $this->analyser->loadSegmentsXml($codesXml);
     $actual = $this->analyser->segments;
     $this->assertEquals($expected, $actual, "Unable to get all segment structures as array");
 }
Exemple #2
0
 public function testProcess()
 {
     $parser = new Parser(__DIR__ . "/../files/example.edi");
     $parsed = $parser->get();
     $this->assertEquals(15, count($parsed));
     $analyser = new Analyser(__DIR__ . "/../files/example.edi");
     $codesXml = __DIR__ . "/../../src/EDI/Mapping/D07A/segments.xml";
     //$analyser->loadSegmentsXml($codesXml);
     $result = $analyser->process($parsed);
     $this->assertEquals(399, strlen($result));
 }
Exemple #3
0
 public function testDESADV()
 {
     $parser = new Parser(__DIR__ . "/../files/D96ADESADV.edi");
     $mapping = new \EDI\Mapping\MappingProvider('D96A');
     $analyser = new Analyser();
     $segs = $analyser->loadSegmentsXml($mapping->getSegments());
     $svc = $analyser->loadSegmentsXml($mapping->getServiceSegments(3));
     $interpreter = new Interpreter($mapping->getMessage('desadv'), $segs, $svc);
     $interpreter->prepare($parser->get());
     $this->assertJsonStringEqualsJsonFile(__DIR__ . "/../files/D96ADESADV.json", $interpreter->getJson(true), "JSON does not match expected output");
     $this->assertCount(2, $interpreter->getMessages());
     $this->assertCount(1, $interpreter->getErrors());
     $this->assertCount(2, $interpreter->getServiceSegments());
     $this->assertEquals([[]], $interpreter->getErrors());
 }