Skip to content

Commit

Permalink
Merge pull request #56 from sprain/improve-file-size
Browse files Browse the repository at this point in the history
Change linebreak to use LF only instead of CR+LF
  • Loading branch information
sprain authored Jun 28, 2020
2 parents a672c2f + 3c11428 commit d0286d8
Show file tree
Hide file tree
Showing 67 changed files with 369 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/QrBill.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private function getQrCodeContent(): string

$qrCodeStringElements = $this->extractQrCodeDataFromElements($elements);

return implode("\r\n", $qrCodeStringElements);
return implode("\n", $qrCodeStringElements);
}

private function extractQrCodeDataFromElements(array $elements): array
Expand Down
4 changes: 1 addition & 3 deletions tests/PaymentPart/Output/HtmlOutput/HtmlOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ class HtmlOutputTest extends TestCase
{
use TestQrBillCreatorTrait;

private $regenerateReferenceHtmlOutputs = false;

/**
* @dataProvider validQrBillsProvider
*/
Expand Down Expand Up @@ -44,7 +42,7 @@ public function testValidQrBills(string $name, QrBill $qrBill)
$htmlOutput->setQrCodeImageFormat($variation['format']);
$output = $htmlOutput->getPaymentPart();

if ($this->regenerateReferenceHtmlOutputs) {
if ($this->regenerateReferenceFiles) {
file_put_contents($file, $output);
}

Expand Down
4 changes: 1 addition & 3 deletions tests/PaymentPart/Output/TcPdfOutput/TcPdfOutputTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class TcPdfOutputTest extends TestCase
{
use TestQrBillCreatorTrait;

private $regenerateReferenceTcPdfOutputs = false;

/**
* @dataProvider validQrBillsProvider
*/
Expand Down Expand Up @@ -53,7 +51,7 @@ public function testValidQrBills(string $name, QrBill $qrBill)
$tcPdfOutput->setQrCodeImageFormat($variation['format']);
$tcPdfOutput->getPaymentPart();

if ($this->regenerateReferenceTcPdfOutputs) {
if ($this->regenerateReferenceFiles) {
$tcPdf->Output($file, 'F');
}

Expand Down
8 changes: 4 additions & 4 deletions tests/QrBillTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class QrBillTest extends TestCase
{
use TestQrBillCreatorTrait;

private $regenerateReferenceQrCodes = false;

/**
* @dataProvider validQrBillsProvider
*/
public function testValidQrBills(string $name, QrBill $qrBill)
{
$file = __DIR__ . '/TestData/QrCodes/' . $name . '.png';
$textFile = __DIR__ . '/TestData/QrCodes/' . $name . '.txt';

if ($this->regenerateReferenceQrCodes) {
if ($this->regenerateReferenceFiles) {
$qrBill->getQrCode()->writeFile($file);
file_put_contents($textFile, $qrBill->getQrCode()->getText());
}

$this->assertSame(
(new QrReader($file))->text(),
file_get_contents($textFile),
$qrBill->getQrCode()->getText()
);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/TestData/HtmlOutput/qr-additional-information.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-alternative-schemes.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tests/TestData/HtmlOutput/qr-full-set.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tests/TestData/HtmlOutput/qr-full-set.print.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-minimal-setup.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-minimal-setup.print.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-payment-reference-non.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-payment-reference-scor.html

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-ultimate-debtor.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/TestData/HtmlOutput/qr-ultimate-debtor.print.html

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions tests/TestData/QrCodes/TestDataTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ public function testQrFile($file, $hash)
public function qrFileProvider()
{
return [
[__DIR__ . '/qr-additional-information.png', '837d81343c5f88e9848bdf2d693daccb'],
[__DIR__ . '/qr-alternative-schemes.png', '72a10b79c4d6011abe784c556caf5e61'],
[__DIR__ . '/qr-full-set.png', 'c0607307841dc5cbdf2c1c5499f869f7'],
[__DIR__ . '/qr-minimal-setup.png', '86fb5a62d7a87d7e31ea91bb5c93bbf9'],
[__DIR__ . '/qr-payment-information-without-amount.png', '0a22b900adc3f65e3aac674c1e891e2d'],
[__DIR__ . '/qr-payment-information-without-amount-but-debtor.png', 'd3be7875b26b4c9f9f92434a947c5f5d'],
[__DIR__ . '/qr-payment-information-zero-amount.png', 'b22b78c16c79dc84a4d890fb95e8d0c9'],
[__DIR__ . '/qr-payment-reference-non.png', '92dd161c4cbecc1fdd00222d346f29d8'],
[__DIR__ . '/qr-payment-reference-scor.png', '51113e54434835e0e628fbe9edc8f333'],
[__DIR__ . '/qr-ultimate-debtor.png', '826e89dbbea4e48ce0b88fb708e7f990'],
[__DIR__ . '/qr-additional-information.png', 'fb9c45f2bc0bf92e941abc64ba50bebb'],
[__DIR__ . '/qr-alternative-schemes.png', '138ac88c4f5d9d127fb11326daa9292a'],
[__DIR__ . '/qr-full-set.png', '969b870f49362a611f62235190fcf03a'],
[__DIR__ . '/qr-minimal-setup.png', '8ed64ec5a2c7a02b1e07aa5eb8e3a7a0'],
[__DIR__ . '/qr-payment-information-without-amount.png', '831b0edb4aca22f5df5f8dec530461dc'],
[__DIR__ . '/qr-payment-information-without-amount-but-debtor.png', '9d4db076385276242cc4a362ee29b58d'],
[__DIR__ . '/qr-payment-information-zero-amount.png', '1e35e396920f07fd0933ecdaabe910f9'],
[__DIR__ . '/qr-payment-reference-non.png', 'abb3ace7ea9f3ef848a335eba98a2375'],
[__DIR__ . '/qr-payment-reference-scor.png', '7e3389311c54ff27e1537d1083656a07'],
[__DIR__ . '/qr-ultimate-debtor.png', 'ac5d8f4155c1d10460de5a0aaea35767'],

[__DIR__ . '/proof-of-validation.png', 'f539fb9c08472ac1f3d74598052e9e5b'],
[__DIR__ . '/proof-of-validation.png', '6bf37bad5b10f54971068a90de36fd0e'],
];
}
}
Binary file modified tests/TestData/QrCodes/proof-of-validation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/TestData/QrCodes/qr-additional-information.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions tests/TestData/QrCodes/qr-additional-information.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF







QRR
123456789012345678901234567
Invoice 1234568 Gardening work
EPD
Bill Information
Binary file modified tests/TestData/QrCodes/qr-alternative-schemes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions tests/TestData/QrCodes/qr-alternative-schemes.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF







QRR
123456789012345678901234567

EPD

foo
foo
Binary file modified tests/TestData/QrCodes/qr-full-set.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions tests/TestData/QrCodes/qr-full-set.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF
K
Thomas LeClaire
Rue examplaire 22a
1000 Lausanne


CH
QRR
123456789012345678901234567
Invoice 1234568 Gardening work
EPD
Bill Information
foo
foo
Binary file modified tests/TestData/QrCodes/qr-minimal-setup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tests/TestData/QrCodes/qr-minimal-setup.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF







QRR
123456789012345678901234567

EPD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH








EUR
K
Thomas LeClaire
Rue examplaire 22a
1000 Lausanne


CH
QRR
123456789012345678901234567

EPD
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tests/TestData/QrCodes/qr-payment-information-without-amount.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH








EUR







QRR
123456789012345678901234567

EPD
Binary file modified tests/TestData/QrCodes/qr-payment-information-zero-amount.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tests/TestData/QrCodes/qr-payment-information-zero-amount.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH4431999123000889012
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







0.00
EUR







QRR
123456789012345678901234567

EPD
Binary file modified tests/TestData/QrCodes/qr-payment-reference-non.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tests/TestData/QrCodes/qr-payment-reference-non.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH9300762011623852957
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF







NON


EPD
Binary file modified tests/TestData/QrCodes/qr-payment-reference-scor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions tests/TestData/QrCodes/qr-payment-reference-scor.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SPC
0200
1
CH9300762011623852957
S
Thomas LeClaire
Rue examplaire
22a
1000
Lausanne
CH







25.90
CHF







SCOR
RF18539007547034

EPD
Binary file modified tests/TestData/QrCodes/qr-ultimate-debtor.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d0286d8

Please sign in to comment.