forked from dfridrich/QRPlatba
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQRPlatbaTest.php
80 lines (67 loc) · 2.21 KB
/
QRPlatbaTest.php
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/*
* This file is part of the library "QRPlatba".
*
* (c) Dennis Fridrich <[email protected]>
*
* For the full copyright and license information,
* please view LICENSE.
*/
use Defr\QRPlatba\QRPlatba;
/**
* Class QRPlatbaTest.
*/
class QRPlatbaTest extends PHPUnit_Framework_TestCase
{
/**
* @expectedException \InvalidArgumentException
*/
public function testFakeCurrencyString()
{
QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setMessage('Düakrítičs')
->setCurrency('FAKE');
}
public function testCzkString()
{
$string = QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setMessage('Düakrítičs');
$this->assertSame(
'SPD*1.0*ACC:CZ0301000000123456789012*AM:1234.56*CC:CZK*MSG:Duakritics*X-VS:2016001234',
$string->__toString()
);
$string = QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setMessage('Düakrítičs')
->setCurrency('CZK');
$this->assertSame(
'SPD*1.0*ACC:CZ0301000000123456789012*AM:1234.56*CC:CZK*MSG:Duakritics*X-VS:2016001234',
$string->__toString()
);
}
public function testEurString()
{
$string = QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setMessage('Düakrítičs')
->setCurrency('EUR');
$this->assertSame(
'SPD*1.0*ACC:CZ0301000000123456789012*AM:1234.56*CC:EUR*MSG:Duakritics*X-VS:2016001234',
$string->__toString()
);
}
public function testQrCodeInstante()
{
$qrPlatba = QRPlatba::create('12-3456789012/0100', 987.60)
->setMessage('QR platba je parádní!')
->getQRCodeInstance();
$this->assertInstanceOf('Endroid\\QrCode\\QrCode', $qrPlatba);
}
public function testRecipientName()
{
$string = QRPlatba::create('12-3456789012/0100', '1234.56', '2016001234')
->setRecipientName('Düakrítičs');
$this->assertSame(
'SPD*1.0*ACC:CZ0301000000123456789012*AM:1234.56*CC:CZK*X-VS:2016001234*RN:Duakritics',
$string->__toString()
);
}
}