|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Disclaimer: This source code is protected by copyright law and by |
|
5
|
|
|
* international conventions. |
|
6
|
|
|
* |
|
7
|
|
|
* Any reproduction or partial or total distribution of the source code, by any |
|
8
|
|
|
* means whatsoever, is strictly forbidden. |
|
9
|
|
|
* |
|
10
|
|
|
* Anyone not complying with these provisions will be guilty of the offense of |
|
11
|
|
|
* infringement and the penal sanctions provided for by law. |
|
12
|
|
|
* |
|
13
|
|
|
* © 2017 All rights reserved. |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
namespace WBW\Library\SkiData\Tests\Parser; |
|
17
|
|
|
|
|
18
|
|
|
use DateTime; |
|
19
|
|
|
use PHPUnit_Framework_TestCase; |
|
20
|
|
|
use WBW\Library\SkiData\Entity\SkiDataUser; |
|
21
|
|
|
use WBW\Library\SkiData\Parser\SkiDataUserParser; |
|
22
|
|
|
|
|
23
|
|
|
/** |
|
24
|
|
|
* SkidData user parser test. |
|
25
|
|
|
* |
|
26
|
|
|
* @author webeweb <https://github.com/webeweb/> |
|
27
|
|
|
* @package WBW\Library\SkiData\Tests\Parser |
|
28
|
|
|
* @final |
|
29
|
|
|
*/ |
|
30
|
|
|
final class SkidDataUserParserTest extends PHPUnit_Framework_TestCase { |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Tests the parseEntity() method. |
|
34
|
|
|
* |
|
35
|
|
|
* @return void |
|
36
|
|
|
*/ |
|
37
|
|
|
public function testParseEntity() { |
|
38
|
|
|
|
|
39
|
|
|
$obj = new SkiDataUser(); |
|
40
|
|
|
$obj->setUserNumber(987654321); |
|
41
|
|
|
$obj->setCustomerNumber(123456789); |
|
42
|
|
|
$obj->setTitle("title"); |
|
43
|
|
|
$obj->setSurname("surname"); |
|
44
|
|
|
$obj->setFirstname("firstname"); |
|
45
|
|
|
$obj->setDateBirth(new DateTime("2017-09-20 11:50:00")); |
|
46
|
|
|
$obj->setParkingSpace("12345"); |
|
47
|
|
|
$obj->setRemarks("remarks"); |
|
48
|
|
|
$obj->setDatetimeLastModification(new DateTime("2017-09-21 11:55:00")); |
|
49
|
|
|
$obj->setDeletedRecord(false); |
|
50
|
|
|
$obj->setIdentificationNumber("identificationNumber"); |
|
51
|
|
|
$obj->setCheckLicensePlate(false); |
|
52
|
|
|
$obj->setPassageLicensePlatePermitted(true); |
|
53
|
|
|
$obj->setExcessTimesCreditCard(true); |
|
54
|
|
|
$obj->setCreditCardNumber("creditCardNumber"); |
|
55
|
|
|
$obj->setExpiryDate(null); |
|
56
|
|
|
$obj->setRemarks2("remarks2"); |
|
57
|
|
|
$obj->setRemarks3("remarks3"); |
|
58
|
|
|
$obj->setDivision("division"); |
|
59
|
|
|
$obj->setEmail("email"); |
|
60
|
|
|
$obj->setGroupCounting(true); |
|
61
|
|
|
$obj->setETicketTypeP(1); |
|
62
|
|
|
$obj->setETicketEmailTelephone("eTicketEmailTelephone"); |
|
63
|
|
|
$obj->setETicketAuthentication(1); |
|
64
|
|
|
$obj->setETicketServiceTyp(3); |
|
65
|
|
|
$obj->setETicketServiceArt(2); |
|
66
|
|
|
|
|
67
|
|
|
$res = '987654321;123456789;"title";"surname";"firstname";20170920;"12345";"remarks";20170921 115500;0;"identificationNumber";0;1;1;"creditCardNumber";;"remarks2";"remarks3";"division";"email";1;1;"eTicketEmailTelephone";1;3;2'; |
|
68
|
|
|
$this->assertEquals($res, (new SkiDataUserParser())->parseEntity($obj)); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
/** |
|
72
|
|
|
* Tests the parseLine() method. |
|
73
|
|
|
* |
|
74
|
|
|
* @retrun void |
|
75
|
|
|
*/ |
|
76
|
|
|
public function testParseLine() { |
|
77
|
|
|
|
|
78
|
|
|
$obj = '987654321;123456789;"title";"surname";"firstname";20170920;"12345";"remarks";20170921 115500;0;"identificationNumber";0;1;1;"creditCardNumber";;"remarks2";"remarks3";"division";"email";1;1;"eTicketEmailTelephone";1;3;2'; |
|
79
|
|
|
|
|
80
|
|
|
$res = (new SkiDataUserParser())->parseLine($obj); |
|
81
|
|
|
$this->assertEquals(987654321, $res->getUserNumber()); |
|
82
|
|
|
$this->assertEquals(123456789, $res->getCustomerNumber()); |
|
83
|
|
|
$this->assertEquals("title", $res->getTitle()); |
|
84
|
|
|
$this->assertEquals("surname", $res->getSurname()); |
|
85
|
|
|
$this->assertEquals("firstname", $res->getFirstname()); |
|
86
|
|
|
$this->assertEquals(new DateTime("2017-09-20 00:00:00"), $res->getDateBirth()); |
|
87
|
|
|
$this->assertEquals("12345", $res->getParkingSpace()); |
|
88
|
|
|
$this->assertEquals("remarks", $res->getRemarks()); |
|
89
|
|
|
$this->assertEquals(new DateTime("2017-09-21 11:55:00"), $res->getDatetimeLastModification()); |
|
90
|
|
|
$this->assertEquals(false, $res->getDeletedRecord()); |
|
91
|
|
|
$this->assertEquals("identificationNumber", $res->getIdentificationNumber()); |
|
92
|
|
|
$this->assertEquals(false, $res->getCheckLicensePlate()); |
|
93
|
|
|
$this->assertEquals(true, $res->getPassageLicensePlatePermitted()); |
|
94
|
|
|
$this->assertEquals(true, $res->getExcessTimesCreditCard()); |
|
95
|
|
|
$this->assertEquals("creditCardNumber", $res->getCreditCardNumber()); |
|
96
|
|
|
$this->assertEquals(null, $res->getExpiryDate()); |
|
97
|
|
|
$this->assertEquals("remarks2", $res->getRemarks2()); |
|
98
|
|
|
$this->assertEquals("remarks3", $res->getRemarks3()); |
|
99
|
|
|
$this->assertEquals("division", $res->getDivision()); |
|
100
|
|
|
$this->assertEquals("email", $res->getEmail()); |
|
101
|
|
|
$this->assertEquals(true, $res->getGroupCounting()); |
|
102
|
|
|
$this->assertEquals(1, $res->getETicketTypeP()); |
|
103
|
|
|
$this->assertEquals("eTicketEmailTelephone", $res->getETicketEmailTelephone()); |
|
104
|
|
|
$this->assertEquals(1, $res->getETicketAuthentication()); |
|
105
|
|
|
$this->assertEquals(3, $res->getETicketServiceTyp()); |
|
106
|
|
|
$this->assertEquals(2, $res->getEticketServiceArt()); |
|
107
|
|
|
} |
|
108
|
|
|
|
|
109
|
|
|
} |
|
110
|
|
|
|