Exemple #1
0
 public function testGetSegmentStructure()
 {
     $segmentsXml = $this->mapping->getSegments();
     $expected = (include __DIR__ . "/../files/segments.php");
     $this->analyser->loadSegmentsXml($segmentsXml);
     $actual = $this->analyser->segments;
     $this->assertEquals($expected, $actual, "Unable to get all segment structures as array");
 }
Exemple #2
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 #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());
 }