Skip to content

Commit e496e46

Browse files
committed
Fix tests
1 parent 8e0197a commit e496e46

File tree

4 files changed

+4
-7
lines changed

4 files changed

+4
-7
lines changed

phpunit.xml

-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
44
bootstrap="tests/bootstrap.php"
5-
cacheDirectory=".phpunit.cache"
65
executionOrder="depends,defects"
7-
requireCoverageMetadata="false"
8-
beStrictAboutCoverageMetadata="false"
96
beStrictAboutOutputDuringTests="true"
107
failOnRisky="true"
118
failOnWarning="true">

src/EDI/Interpreter.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ private function processXmlSegment(\SimpleXMLElement $elm, array &$message, int
631631
} else {
632632
if (! $segmentVisited && isset($elm['required'])) {
633633
$segmentVisited = true;
634-
if (\call_user_func($this->comparisonFunction, $message[$segmentIdx+1], $elm)) {
634+
if (isset($message[$segmentIdx+1]) && \call_user_func($this->comparisonFunction, $message[$segmentIdx+1], $elm)) {
635635
$errors[] = [
636636
'text' => $this->messageTextConf['SPURIOUSSEGMENT'].($this->patchFiles ? ' (skipped)' : ''),
637637
'position' => $segmentIdx,

tests/EDITest/InterpreterTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ public function testDESADV()
9191
'JSON does not match expected output'
9292
);
9393

94-
static::assertSame(3598, \strlen($interpreter->getJson()));
95-
static::assertSame(9383, \strlen($interpreter->getJson(true)));
94+
static::assertSame(3594, \strlen($interpreter->getJson()));
95+
static::assertSame(9379, \strlen($interpreter->getJson(true)));
9696

9797
static::assertCount(2, $interpreter->getMessages());
9898
static::assertCount(0, $interpreter->getErrors());

tests/files/D96ADESADV.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"messageTrailer": {
228228
"segmentIdx": 20,
229229
"segmentCode": "UNT",
230-
"segmentGroup": "SG16",
230+
"segmentGroup": "",
231231
"numberOfSegmentsInTheMessage": "21",
232232
"messageReferenceNumber": "142"
233233
}

0 commit comments

Comments
 (0)