Skip to content

Commit

Permalink
switched to gh-actions, added php8 and removed 7.1 (#42)
Browse files Browse the repository at this point in the history
removed TravisCI as CI and added Github Actions.
deleted compatibility for php7.2
moved php-unit from 7 to 8
  • Loading branch information
twitnic authored Oct 29, 2021
1 parent 76b215a commit 2bf7acf
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 18 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PhpUnit

on: [push]

jobs:
run:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-18.04']
php-versions: ['7.2', '7.3', '7.4', '8.0']

steps:
- uses: actions/checkout@v1

- name: Run composer install
run: composer install -n --prefer-dist
env:
APP_ENV: testing

- name: Prepare Application
run: |
cp phpunit.xml.dist phpunit.xml
- name: PHPUnit Tests
run: ./vendor/bin/phpunit
env:
TEST_NAME: DEV
# with:
# bootstrap: vendor/autoload.php
# configuration: test/phpunit.xml
# args: --coverage-text

# - name: Upload artifacts
# uses: actions/upload-artifact@master
# if: failure()
# with:
# name: Logs
# path: ./storage/logs
15 changes: 0 additions & 15 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
}
],
"require": {
"php": ">=7.1.0"
"php": ">=7.2.0||^8.0"
},
"require-dev": {
"phpunit/phpunit": "^7",
"phpunit/phpunit": "^8",
"squizlabs/php_codesniffer": "3.*"
},
"autoload": {
Expand Down
4 changes: 4 additions & 0 deletions lib/Jejik/MT940/Parser/AbstractParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,10 @@ protected function getTransactionLines($text): ?array {
$multiPurposeField = $match;
}

if ($amountLine[1] === null) {
return [];
}

$count = count($amountLine[1]);
$result = [];
for ($i = 0; $i < $count; $i++) {
Expand Down
5 changes: 4 additions & 1 deletion lib/Jejik/MT940/Parser/GermanBank.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ protected function getSubfield(string $multiUseLine, string $identifier): ?strin
do {
$fieldIdentifier = next($splitReferenceLine) ?: 'unknown';
$fieldContent = next($splitReferenceLine) ?: null;
$subfields[$fieldIdentifier] = preg_replace('#\?2[0-9]#', '', $fieldContent);

if ($fieldContent !== null) {
$subfields[$fieldIdentifier] = preg_replace('#\?2[0-9]#', '', $fieldContent);
}
} while (next($splitReferenceLine) !== false);

return $subfields[$identifier] ?? null;
Expand Down

0 comments on commit 2bf7acf

Please sign in to comment.