Passed
Push — master ( b2accd...5a4945 )
by WEBEWEB
01:50
created

SkiDataCustomerParserTest::testParseLine()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 34

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 34
nc 1
nop 0
dl 0
loc 37
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of the skidata-library package.
5
 *
6
 * (c) 2017 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Library\SkiData\Tests\Parser;
13
14
use DateTime;
15
use PHPUnit_Framework_TestCase;
16
use WBW\Library\SkiData\Entity\SkiDataCustomer;
17
use WBW\Library\SkiData\Parser\SkiDataCustomerParser;
18
19
/**
20
 * SkiData customer parser test.
21
 *
22
 * @author webeweb <https://github.com/webeweb/>
23
 * @package WBW\Library\SkiData\Tests\Parser
24
 * @final
25
 */
26
final class SkiDataCustomerParserTest extends PHPUnit_Framework_TestCase {
27
28
    /**
29
     * Tests the parseEntity() method.
30
     *
31
     * @return void
32
     */
33
    public function testParseEntity() {
34
35
        $obj = new SkiDataCustomer();
36
        $obj->setCustomerNumber(123456789);
37
        $obj->setTitle("title");
38
        $obj->setSurname("surname");
39
        $obj->setFirstname("firstname");
40
        $obj->setStreet("street");
41
        $obj->setPCode("pCode");
42
        $obj->setCity("city");
43
        $obj->setCountry("abc");
44
        $obj->setTaxCode("taxCode");
45
        $obj->setIdDocumentNo("idDocumentNo");
46
        $obj->setTelephone("telephone");
47
        $obj->setRentalAgreementNo("rentalAgreementNo");
48
        $obj->setBeginDate(new DateTime("2017-09-21 10:30:00"));
49
        $obj->setTerminationDate(new DateTime("2017-09-30 10:30:00"));
50
        $obj->setDeposit(123456);
51
        $obj->setMaximumLevel(1234);
52
        $obj->setRemarks("remarks");
53
        $obj->setDatetimeLastModification(new DateTime("2017-09-21 10:35:00"));
54
        $obj->setBlocked(false);
55
        $obj->setBlockedDate(null);
56
        $obj->setDeletedRecord(false);
57
        $obj->setTicketReturnAllowed(true);
58
        $obj->setGroupCounting(true);
59
        $obj->setEntryMaxLevelAllowed(false);
60
        $obj->setMaxLevelCarPark(true);
61
        $obj->setRemarks2("remarks2");
62
        $obj->setRemarks3("remarks3");
63
        $obj->setDivision("division");
64
        $obj->setEmail("email");
65
        $obj->setCountingNeutralCards(false);
66
        $obj->setNationality("abc");
67
        $obj->setAccountingNumber("accountingNumber");
68
69
        $res = '123456789;"title";"surname";"firstname";"street";"pCode";"city";"abc";"taxCode";"idDocumentNo";"telephone";"rentalAgreementNo";20170921;20170930;000000123456;1234;"remarks";20170921 103500;0;;0;1;1;0;1;"remarks2";"remarks3";"division";"email";0;"abc";"accountingNumber"';
70
        $this->assertEquals($res, (new SkiDataCustomerParser())->parseEntity($obj));
71
    }
72
73
    /**
74
     * Tests the parseLine() method.
75
     *
76
     * @return void
77
     */
78
    public function testParseLine() {
79
80
        $obj = '123456789;"title";"surname";"firstname";"street";"pCode";"city";"abc";"taxCode";"idDocumentNo";"telephone";"rentalAgreementNo";20170921;20170930;000000123456;1234;"remarks";20170921 103500;0;;0;1;1;0;1;"remarks2";"remarks3";"division";"email";0;"abc";"accountingNumber"';
81
82
        $res = (new SkiDataCustomerParser())->parseLine($obj);
83
        $this->assertEquals(123456789, $res->getCustomerNumber());
84
        $this->assertEquals("title", $res->getTitle());
85
        $this->assertEquals("surname", $res->getSurname());
86
        $this->assertEquals("firstname", $res->getFirstname());
87
        $this->assertEquals("street", $res->getStreet());
88
        $this->assertEquals("pCode", $res->getPCode());
89
        $this->assertEquals("city", $res->getCity());
90
        $this->assertEquals("abc", $res->getCountry());
91
        $this->assertEquals("taxCode", $res->getTaxCode());
92
        $this->assertEquals("idDocumentNo", $res->getIdDocumentNo());
93
        $this->assertEquals("telephone", $res->getTelephone());
94
        $this->assertEquals("rentalAgreementNo", $res->getRentalAgreementNo());
95
        $this->assertEquals(new DateTime("2017-09-21 00:00:00"), $res->getBeginDate());
96
        $this->assertEquals(new DateTime("2017-09-30 00:00:00"), $res->getTerminationDate());
97
        $this->assertEquals(123456, $res->getDeposit());
98
        $this->assertEquals(1234, $res->getMaximumLevel());
99
        $this->assertEquals("remarks", $res->getRemarks());
100
        $this->assertEquals(new DateTime("2017-09-21 10:35:00"), $res->getDatetimeLastModification());
101
        $this->assertEquals(false, $res->getBlocked());
102
        $this->assertEquals(null, $res->getBlockedDate());
103
        $this->assertEquals(false, $res->getDeletedRecord());
104
        $this->assertEquals(true, $res->getTicketReturnAllowed());
105
        $this->assertEquals(true, $res->getGroupCounting());
106
        $this->assertEquals(false, $res->getEntryMaxLevelAllowed());
107
        $this->assertEquals(true, $res->getMaxLevelCarPark());
108
        $this->assertEquals("remarks2", $res->getRemarks2());
109
        $this->assertEquals("remarks3", $res->getRemarks3());
110
        $this->assertEquals("division", $res->getDivision());
111
        $this->assertEquals("email", $res->getEmail());
112
        $this->assertEquals(false, $res->getCountingNeutralCards());
113
        $this->assertEquals("abc", $res->getNationality());
114
        $this->assertEquals("accountingNumber", $res->getAccountingNumber());
115
    }
116
117
}
118