Skip to content

Commit fb840ff

Browse files
authored
Merge pull request #1 from php-edifact/master
Merge
2 parents e10ebc8 + 794bce9 commit fb840ff

21 files changed

+2802
-640
lines changed

.editorconfig

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# http://editorconfig.org
2+
root = true
3+
4+
[*]
5+
indent_style = space
6+
indent_size = 4
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true

.gitattributes

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
* text=auto
2+
3+
/tests export-ignore
4+
/.editorconfig export-ignore
5+
/.gitattributes export-ignore
6+
/.gitignore export-ignore
7+
/.travis.yml export-ignore
8+
/phpunit.xml export-ignore

.travis.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
language: php
2+
3+
sudo: false
4+
5+
matrix:
6+
fast_finish: true
7+
allow_failures:
8+
- php: nightly
9+
include:
10+
- php: 7.0
11+
- php: 7.1
12+
- php: 7.2
13+
- php: 7.3
14+
- php: nightly
15+
16+
before_script:
17+
- php --version
18+
- wget https://scrutinizer-ci.com/ocular.phar
19+
- travis_retry composer self-update
20+
- travis_retry composer require satooshi/php-coveralls:1.0.0
21+
- travis_retry composer install --no-interaction --prefer-source
22+
- composer dump-autoload -o
23+
24+
script:
25+
- mkdir -p build/logs
26+
- php vendor/bin/phpunit -c phpunit.xml --debug
27+
28+
after_script:
29+
- php vendor/bin/coveralls -v
30+
- php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml
31+
- bash <(curl -s https://codecov.io/bash)

EXAMPLES.md

+32
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,38 @@ $analyser->loadSegmentsXml('edifact/src/EDI/Mapping/d95b/segments.xml');
4040
$text = $analyser->process($parsed, $segments);
4141
```
4242

43+
EDI data reading from extracted group
44+
-------------------------------------
45+
46+
As not to have to go through the indexes for extracted groups, just set the group as ParsedFile of the reader.
47+
48+
E.g. inventory messages (snippet, not a valid EDI message!):
49+
50+
```
51+
INV+2++1'QTY+156:1000:PCE'QTY+145:3000:PCE'LOC+18+YA:::567'DTM+179:20180509:102'RFF+AAK:TEST'DTM+171:20180509:102'
52+
INV+1++11'QTY+156:200:PCE'QTY+145:2800:PCE'LOC+18+YA:::567'DTM+179:20180509:102'RFF+ALO:4916165350'DTM+171:20180509:102'
53+
INV+1++11'QTY+156:200:PCE'QTY+145:2600:PCE'LOC+18+YA:::567'DTM+179:20180509:102'RFF+ALO:4916165351'DTM+171:20180509:102'
54+
INV+1++11'QTY+156:200:PCE'QTY+145:2400:PCE'LOC+18+YA:::567'DTM+179:20180509:102'RFF+ALO:4916165352'DTM+171:20180509:102'
55+
INV+1++11'QTY+156:100:PCE'QTY+145:2300:PCE'LOC+18+YA:::567'DTM+179:20180510:102'RFF+ALO:4916165359'DTM+171:20180510:102'
56+
```
57+
58+
```php
59+
$reader = new EDI\Reader($fileName);
60+
$recordReader = EDI\Reader();
61+
$groups = $reader->groupsExtract('INV');
62+
63+
foreach ($groups as $record) {
64+
$recordReader->setParsedFile($record);
65+
$records[] = [
66+
'storageLocation' => $recordReader->readEdiDataValue(['LOC', ['2.0' => 'YA']], 2, 3),
67+
'bookingDate' => $recordReader->readEdiSegmentDTM(179),
68+
'enteredOn' => $recordReader->readEdiSegmentDTM(171),
69+
'quantity' => $r->readEdiDataValue(['QTY', ['1.0' => 156]], 1, 1),
70+
'actualStock' => $r->readEdiDataValue(['QTY', ['1.0' => 145]], 1, 1)
71+
];
72+
}
73+
```
74+
4375
Readable EDI file
4476
-----------------
4577
```

composer.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@
2929
"url": "https://github.com/php-edifact/edifact"
3030
}
3131
],
32+
"require": {
33+
"php": ">=7.0.0",
34+
"ext-simplexml": "*",
35+
"ext-json": "*",
36+
"voku/arrayy": "5.*"
37+
},
3238
"require-dev": {
33-
"phpunit/phpunit": "4.1.*",
39+
"phpunit/phpunit": "~6.0",
3440
"php-edifact/edifact-mapping": "dev-master"
3541
},
3642
"autoload": {

phpunit.xml

+21-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<phpunit bootstrap="tests/Bootstrap.php" colors="true">
3+
<phpunit backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
syntaxCheck="false"
12+
bootstrap="tests/bootstrap.php"
13+
verbose="true"
14+
testdox="true"
15+
>
416
<testsuites>
517
<testsuite name="sabas/edifact">
618
<directory>./tests/EDITest</directory>
719
</testsuite>
820
</testsuites>
921
<filter>
10-
<whitelist>
11-
<directory suffix=".php">./src/</directory>
12-
</whitelist>
22+
<whitelist processUncoveredFilesFromWhitelist="true">
23+
<directory suffix=".php">./src/</directory>
24+
</whitelist>
25+
<blacklist>
26+
<directory suffix=".php">./vendor</directory>
27+
</blacklist>
1328
</filter>
1429
<logging>
15-
<log type="coverage-html" target="./codeCoverage" charset="UTF-8"
16-
yui="true" highlight="true"/>
30+
<log type="coverage-clover" target="build/logs/clover.xml"/>
1731
</logging>
18-
</phpunit>
32+
</phpunit>

0 commit comments

Comments
 (0)