-
Notifications
You must be signed in to change notification settings - Fork 455
Expand file tree
/
Copy pathEPCTest.php
More file actions
55 lines (47 loc) · 1.54 KB
/
EPCTest.php
File metadata and controls
55 lines (47 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
use PHPUnit\Framework\TestCase;
use SimpleSoftwareIO\QrCode\DataTypes\EPC;
class EPCTest extends TestCase
{
public function testToString()
{
$arguments = [
'bic' => 'BIC123',
'iban' => 'IBAN456',
'amount' => '1000.50',
'name' => 'John Doe',
'text' => 'Test payment',
];
$epc = new EPC();
$epc->create([$arguments]);
$expected = "BCD\n";
$expected .= "002\n";
$expected .= "2\n";
$expected .= "SCT\n";
$expected .= $arguments['bic']."\n";
$expected .= $arguments['name']."\n";
$expected .= $arguments['iban']."\n";
$expected .= 'EUR'.number_format($arguments['amount'], 2)."\n";
$expected .= "\n";
$expected .= "\n";
$expected .= $arguments['text']."\n";
$this->assertEquals($expected, $epc->__toString());
}
public function testSetProperties()
{
$arguments = [
'bic' => 'BIC123',
'iban' => 'IBAN456',
'amount' => '1000.50',
'name' => 'John Doe',
'text' => 'Test payment',
];
$epc = new EPC();
$epc->create([$arguments]);
$this->assertEquals($arguments['bic'], $epc->getBic());
$this->assertEquals($arguments['iban'], $epc->getIban());
$this->assertEquals($arguments['amount'], $epc->getAmount());
$this->assertEquals($arguments['name'], $epc->getName());
$this->assertEquals($arguments['text'], $epc->getText());
}
}