Skip to content

Commit 4167009

Browse files
QuentinGabgithub-actions[bot]
authored andcommitted
Fix styling
1 parent 45c0980 commit 4167009

File tree

2 files changed

+104
-104
lines changed

2 files changed

+104
-104
lines changed
Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,71 @@
1-
<?php
2-
3-
use Brick\Money\Money;
4-
use Finller\Invoice\PdfInvoiceItem;
5-
6-
it('computes the right subTotalAmount', function ($unit_price, $quantity, $unit_tax, $expected) {
7-
$item = new PdfInvoiceItem(
8-
label: "Item 1",
9-
unit_price: Money::of($unit_price, 'USD'),
10-
quantity: $quantity,
11-
unit_tax: Money::of($unit_tax, 'USD')
12-
);
13-
14-
expect($item->subTotalAmount())->toCost($expected, 'USD');
15-
})->with([
16-
[110, 3, 10, 330],
17-
[1567, 3, 209, 4701],
18-
[578, 0, 468, 0],
19-
]);
20-
21-
it('computes the right totalTaxAmount with unit_tax', function ($unit_price, $quantity, $unit_tax, $expected) {
22-
$item = new PdfInvoiceItem(
23-
label: "Item 1",
24-
unit_price: Money::of($unit_price, 'USD'),
25-
quantity: $quantity,
26-
unit_tax: Money::of($unit_tax, 'USD')
27-
);
28-
29-
expect($item->totalTaxAmount())->toCost($expected, 'USD');
30-
})->with([
31-
[110, 3, 10, 30],
32-
[1567, 3, 209, 627],
33-
[578, 0, 468, 0],
34-
[0, 10, 468, 4680],
35-
]);
36-
37-
it('computes the right totalTaxAmount with tax_percentage', function ($unit_price, $quantity, $tax_percentage, $expected) {
38-
$item = new PdfInvoiceItem(
39-
label: "Item 1",
40-
unit_price: Money::of($unit_price, 'USD'),
41-
quantity: $quantity,
42-
tax_percentage: $tax_percentage
43-
);
44-
45-
expect($item->totalTaxAmount())->toCost($expected, 'USD');
46-
})->with([
47-
[110, 3, 20, 66],
48-
[1567, 3, 10, 470.1],
49-
[578, 0, 30, 0],
50-
[0, 10, 20, 0],
51-
[6789, 10, 0, 0],
52-
]);
53-
54-
it('computes the right totalTaxAmount with unit_tax when both unit_tax and tax_percentage are defined', function ($unit_price, $quantity, $unit_tax, $tax_percentage, $expected) {
55-
$item = new PdfInvoiceItem(
56-
label: "Item 1",
57-
unit_price: Money::of($unit_price, 'USD'),
58-
quantity: $quantity,
59-
tax_percentage: $tax_percentage,
60-
unit_tax: Money::of($unit_tax, 'USD')
61-
);
62-
63-
expect($item->totalTaxAmount())->toCost($expected, 'USD');
64-
})->with([
65-
[110, 3, 100, 20, 300],
66-
[1567, 3, 30, 10, 90],
67-
[578, 0, 10, 30, 0],
68-
[0, 10, 50, 20, 500],
69-
[6789, 10, 10, 0, 100],
70-
[938, 10, 0, 20, 0],
71-
]);
1+
<?php
2+
3+
use Brick\Money\Money;
4+
use Finller\Invoice\PdfInvoiceItem;
5+
6+
it('computes the right subTotalAmount', function ($unit_price, $quantity, $unit_tax, $expected) {
7+
$item = new PdfInvoiceItem(
8+
label: 'Item 1',
9+
unit_price: Money::of($unit_price, 'USD'),
10+
quantity: $quantity,
11+
unit_tax: Money::of($unit_tax, 'USD')
12+
);
13+
14+
expect($item->subTotalAmount())->toCost($expected, 'USD');
15+
})->with([
16+
[110, 3, 10, 330],
17+
[1567, 3, 209, 4701],
18+
[578, 0, 468, 0],
19+
]);
20+
21+
it('computes the right totalTaxAmount with unit_tax', function ($unit_price, $quantity, $unit_tax, $expected) {
22+
$item = new PdfInvoiceItem(
23+
label: 'Item 1',
24+
unit_price: Money::of($unit_price, 'USD'),
25+
quantity: $quantity,
26+
unit_tax: Money::of($unit_tax, 'USD')
27+
);
28+
29+
expect($item->totalTaxAmount())->toCost($expected, 'USD');
30+
})->with([
31+
[110, 3, 10, 30],
32+
[1567, 3, 209, 627],
33+
[578, 0, 468, 0],
34+
[0, 10, 468, 4680],
35+
]);
36+
37+
it('computes the right totalTaxAmount with tax_percentage', function ($unit_price, $quantity, $tax_percentage, $expected) {
38+
$item = new PdfInvoiceItem(
39+
label: 'Item 1',
40+
unit_price: Money::of($unit_price, 'USD'),
41+
quantity: $quantity,
42+
tax_percentage: $tax_percentage
43+
);
44+
45+
expect($item->totalTaxAmount())->toCost($expected, 'USD');
46+
})->with([
47+
[110, 3, 20, 66],
48+
[1567, 3, 10, 470.1],
49+
[578, 0, 30, 0],
50+
[0, 10, 20, 0],
51+
[6789, 10, 0, 0],
52+
]);
53+
54+
it('computes the right totalTaxAmount with unit_tax when both unit_tax and tax_percentage are defined', function ($unit_price, $quantity, $unit_tax, $tax_percentage, $expected) {
55+
$item = new PdfInvoiceItem(
56+
label: 'Item 1',
57+
unit_price: Money::of($unit_price, 'USD'),
58+
quantity: $quantity,
59+
tax_percentage: $tax_percentage,
60+
unit_tax: Money::of($unit_tax, 'USD')
61+
);
62+
63+
expect($item->totalTaxAmount())->toCost($expected, 'USD');
64+
})->with([
65+
[110, 3, 100, 20, 300],
66+
[1567, 3, 30, 10, 90],
67+
[578, 0, 10, 30, 0],
68+
[0, 10, 50, 20, 500],
69+
[6789, 10, 10, 0, 100],
70+
[938, 10, 0, 20, 0],
71+
]);

tests/Feature/PdfInvoiceTest.php

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
<?php
2-
3-
use Brick\Money\Money;
4-
use Finller\Invoice\PdfInvoice;
5-
use Finller\Invoice\PdfInvoiceItem;
6-
7-
it('computes the right subTotalAmount, totalTaxAmount and totalAmount', function () {
8-
$pdfInvoice = new PdfInvoice(
9-
name: "Invoice",
10-
serial_number: "FAKE-INVOICE-01",
11-
state: "paid",
12-
due_at: now(),
13-
created_at: now(),
14-
buyer: config('invoices.default_seller')
15-
);
16-
17-
$pdfInvoice->items = [
18-
new PdfInvoiceItem(
19-
label: "Item 1",
20-
unit_price: Money::of(110, 'USD'),
21-
unit_tax: Money::of(10, 'USD')
22-
),
23-
new PdfInvoiceItem(
24-
label: "Item 1",
25-
unit_price: Money::of(234, 'USD'),
26-
unit_tax: Money::of(12, 'USD')
27-
),
28-
];
29-
30-
expect($pdfInvoice->subTotalAmount())->toCost(344, 'USD');
31-
expect($pdfInvoice->totalTaxAmount())->toCost(22, 'USD');
32-
expect($pdfInvoice->totalAmount())->toCost(366, 'USD');
33-
});
1+
<?php
2+
3+
use Brick\Money\Money;
4+
use Finller\Invoice\PdfInvoice;
5+
use Finller\Invoice\PdfInvoiceItem;
6+
7+
it('computes the right subTotalAmount, totalTaxAmount and totalAmount', function () {
8+
$pdfInvoice = new PdfInvoice(
9+
name: 'Invoice',
10+
serial_number: 'FAKE-INVOICE-01',
11+
state: 'paid',
12+
due_at: now(),
13+
created_at: now(),
14+
buyer: config('invoices.default_seller')
15+
);
16+
17+
$pdfInvoice->items = [
18+
new PdfInvoiceItem(
19+
label: 'Item 1',
20+
unit_price: Money::of(110, 'USD'),
21+
unit_tax: Money::of(10, 'USD')
22+
),
23+
new PdfInvoiceItem(
24+
label: 'Item 1',
25+
unit_price: Money::of(234, 'USD'),
26+
unit_tax: Money::of(12, 'USD')
27+
),
28+
];
29+
30+
expect($pdfInvoice->subTotalAmount())->toCost(344, 'USD');
31+
expect($pdfInvoice->totalTaxAmount())->toCost(22, 'USD');
32+
expect($pdfInvoice->totalAmount())->toCost(366, 'USD');
33+
});

0 commit comments

Comments
 (0)