Skip to content

Commit

Permalink
Fix integer overflow for large account numbers (#36)
Browse files Browse the repository at this point in the history
  • Loading branch information
RikudouSage committed May 10, 2021
1 parent 2fb4111 commit 47a9964
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/test.yaml
Expand Up @@ -81,3 +81,20 @@ jobs:
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r build/logs/clover.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
tests-32bit:
name: Test 32 bit php
runs-on: ubuntu-latest
container: shivammathur/node:latest-i386
steps:
- name: Install PHP
run: |
spc -U
spc --php-version "7.4" --coverage "xdebug"
- name: Checkout Code
run: |
git clone $GITHUB_SERVER_URL/$GITHUB_REPOSITORY .
[ -n "$GITHUB_HEAD_REF" ] && git checkout $GITHUB_HEAD_REF || git checkout $GITHUB_SHA
- name: Install Dependencies
run: composer install
- name: Tests
run: composer phpunit
2 changes: 1 addition & 1 deletion composer.json
Expand Up @@ -17,7 +17,7 @@
"require": {
"php": "^7.3 | ^8.0",
"rikudou/qr-payment-interface": "^1.0",
"rikudou/iban": "^1.1"
"rikudou/iban": "^1.1.1"
},
"autoload": {
"psr-4": {
Expand Down
9 changes: 9 additions & 0 deletions tests/QrPaymentTest.php
Expand Up @@ -287,6 +287,15 @@ public function testPayeeName()
$this->instance->getQrString();
}

/**
* @see https://github.com/RikudouSage/QrPaymentCZ/issues/35
*/
public function testIntegerOverflow(): void
{
$qrString = QrPayment::fromAccountAndBankCode('2901972682', '0100')->getQrString();
self::assertEquals('SPD*1.0*ACC:CZ1401000000002901972682*AM:0.00*CC:CZK*X-PER:7', $qrString);
}

private function getIban(): IBAN
{
return new IBAN('CZ5530300000001325090010');
Expand Down

0 comments on commit 47a9964

Please sign in to comment.