Skip to content

Commit be08892

Browse files
composer update - voku/array dev requirement only
- php: ~8 - phpunit: ~9 - dev: - voku/array: ~7.1
1 parent 4233093 commit be08892

File tree

5 files changed

+43
-31
lines changed

5 files changed

+43
-31
lines changed

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@
2626
}
2727
],
2828
"require": {
29-
"php": ">=7.0.0",
29+
"php": "~8",
3030
"ext-json": "*",
3131
"ext-simplexml": "*"
3232
},
3333
"require-dev": {
3434
"php-edifact/edifact-mapping": "dev-master",
35-
"phpunit/phpunit": "~6.0"
35+
"phpunit/phpunit": "~9.0",
36+
"voku/arrayy": "~7.1"
3637
},
3738
"autoload": {
3839
"psr-4": {

src/EDI/Interpreter.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,16 @@ public function getJson(bool $pretty = false)
261261
return \json_encode($this->ediGroups);
262262
}
263263

264+
/**
265+
* Get EDI groups.
266+
*
267+
* @return array
268+
*/
269+
public function getEdiGroups()
270+
{
271+
return $this->ediGroups;
272+
}
273+
264274
/**
265275
* Get errors
266276
*

tests/EDITest/AnalyserTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class AnalyserTest extends TestCase
2222
*/
2323
protected $mapping;
2424

25-
protected function setUp()
25+
protected function setUp(): void
2626
{
2727
$this->analyser = new Analyser();
2828
$this->mapping = new MappingProvider('D07A');

tests/EDITest/InterpreterTest.php

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
namespace EDITest;
44

5+
use EDI\Parser;
56
use EDI\Analyser;
7+
use Arrayy\Arrayy;
68
use EDI\Interpreter;
7-
use EDI\Parser;
89

910
/**
1011
* @internal
@@ -146,20 +147,20 @@ public function testOrderError()
146147

147148
static::assertCount(2, $interpreter->getMessages());
148149

149-
static::assertContains('"messageHeader"', $interpreter->getJson(true));
150-
static::assertContains('"interchangeHeader"', $interpreter->getJsonServiceSegments(true));
150+
$this->assertStringContainsString('"messageHeader"', $interpreter->getJson(true));
151+
static::assertStringContainsString('"interchangeHeader"', $interpreter->getJsonServiceSegments(true));
151152

152-
// $arrayy = $interpreter->getArrayy();
153-
// static::assertSame(
154-
// 'Butter 40x250g Alu',
155-
// $arrayy->get('0.SG25.0.itemDescription.itemDescription.itemDescription')
156-
// );
153+
$arrayy = new Arrayy($interpreter->getEdiGroups());
154+
static::assertSame(
155+
'Butter 40x250g Alu',
156+
$arrayy->get('0.SG25.0.itemDescription.itemDescription.itemDescription')
157+
);
157158

158-
// $arrayy = $interpreter->getArrayyServiceSegments();
159-
// static::assertCount(
160-
// 14,
161-
// $arrayy->get('interchangeHeader')
162-
// );
159+
$arrayy = new Arrayy($interpreter->getServiceSegments());
160+
static::assertCount(
161+
14,
162+
$arrayy->get('interchangeHeader')
163+
);
163164
}
164165

165166
public function testOrderOk()
@@ -181,20 +182,20 @@ public function testOrderOk()
181182

182183
static::assertCount(2, $interpreter->getMessages());
183184

184-
static::assertContains('"messageHeader"', $interpreter->getJson(true));
185-
static::assertContains('"interchangeHeader"', $interpreter->getJsonServiceSegments(true));
185+
static::assertStringContainsString('"messageHeader"', $interpreter->getJson(true));
186+
static::assertStringContainsString('"interchangeHeader"', $interpreter->getJsonServiceSegments(true));
186187

187-
// $arrayy = $interpreter->getArrayy();
188-
// static::assertSame(
189-
// 'Butter 40x250g Alu',
190-
// $arrayy->get('0.SG25.0.itemDescription.itemDescription.itemDescription')
191-
// );
188+
$arrayy = new Arrayy($interpreter->getEdiGroups());
189+
static::assertSame(
190+
'Butter 40x250g Alu',
191+
$arrayy->get('0.SG25.0.itemDescription.itemDescription.itemDescription')
192+
);
192193

193-
// $arrayy = $interpreter->getArrayyServiceSegments();
194-
// static::assertCount(
195-
// 14,
196-
// $arrayy->get('interchangeHeader')
197-
// );
194+
$arrayy = new Arrayy($interpreter->getServiceSegments());
195+
static::assertCount(
196+
14,
197+
$arrayy->get('interchangeHeader')
198+
);
198199
}
199200

200201
public function testMissingUNBUNH()

tests/EDITest/ParserTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ public function testFileOk()
104104
static::assertSame([], $errors);
105105

106106
$data = \json_encode((new Parser($string))->get());
107-
static::assertContains('Sup 1:10', $data);
108-
static::assertNotContains('Konzentrat:o', $data);
109-
static::assertContains('"Rindfleischsuppe Konzentrat","o', $data);
107+
static::assertStringContainsString('Sup 1:10', $data);
108+
static::assertStringNotContainsString('Konzentrat:o', $data);
109+
static::assertStringContainsString('"Rindfleischsuppe Konzentrat","o', $data);
110110
}
111111

112112
public function testFileError()

0 commit comments

Comments
 (0)