Skip to content

Commit d9d225d

Browse files
committed
tests updated
1 parent dad8094 commit d9d225d

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

tests/unit/ServicesTest.php

+89
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,83 @@ class ServicesTest extends TestCase
7575
'phone' => '+22123456',*/
7676
];
7777

78+
79+
/* public function test_add_packages_with_services()
80+
{
81+
$dpd = new DPDService();
82+
$dpd->setSender($this->sender);
83+
84+
$services1 = [
85+
'declaredValue' => [
86+
'amount' => 10000,
87+
'currency' => 'PLN'
88+
]
89+
];
90+
91+
$services2 = [
92+
'guarantee' => [
93+
'type' => 'B2C',
94+
'value' => '15:00-18:00'
95+
]
96+
];
97+
98+
$services3 = [
99+
'cod' => [
100+
'amount' => 989.32,
101+
'currency' => 'PLN'
102+
]
103+
];
104+
105+
$services4 = [
106+
'inpers' => '',
107+
'carryin'
108+
];
109+
110+
$packages = [];
111+
112+
// prepare packages
113+
array_push($packages, $dpd->createPackage($this->parcels, $this->receiver, 'SENDER', $services1, 'REF123'));
114+
array_push($packages, $dpd->createPackage($this->parcels2, $this->receiver, 'SENDER', $services2, 'REF456'));
115+
array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER', $services3, 'REF789'));
116+
array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER', $services4));
117+
118+
$result = $dpd->sendPackages($packages);
119+
120+
$this->assertTrue(isset($result->packages) && count($result->packages) == count($packages));
121+
122+
// generate speedlabel
123+
$speedlabel = $dpd->generateSpeedLabelsBySessionId($dpd->getSessionId(), $this->pickupAddress);
124+
$this->assertTrue(isset($speedlabel->filedata));
125+
126+
// save speedlabel to pdf file
127+
//file_put_contents('pdf/slbl-sid' . $dpd->getSessionId() . '.pdf', $speedlabel->filedata);
128+
129+
// generate protocol
130+
$protocol = $dpd->generateProtocolBySessionId($dpd->getSessionId(), $this->pickupAddress);
131+
132+
$this->assertTrue(isset($protocol->filedata));
133+
134+
// save protocol to pdf file
135+
//file_put_contents('pdf/prot-sid' . $dpd->getSessionId() . '.pdf', $protocol->filedata);
136+
137+
// pickup call
138+
$pickupDate = '2017-08-23';
139+
$pickupTimeFrom = '13:00';
140+
$pickupTimeTo = '16:00';
141+
$contactInfo = [
142+
'name' => 'Janusz Biznesu',
143+
'company' => 'INCO',
144+
'phone' => '12 5555555',
145+
'email' => 'januszbiznesu@_inco.pl',
146+
'comments' => 'proszę dzownić domofonem'
147+
148+
];
149+
150+
$pickup = $dpd->pickupRequest([$protocol->documentId], $pickupDate, $pickupTimeFrom, $pickupTimeTo, $contactInfo, $this->pickupAddress);
151+
152+
153+
}
154+
78155
public function test_add_package()
79156
{
80157
@@ -115,6 +192,7 @@ public function test_add_packages()
115192
array_push($packages, $dpd->createPackage($this->parcels3, $this->receiver, 'SENDER'));
116193
117194
$result = $dpd->sendPackages($packages);
195+
118196
$this->assertTrue(isset($result->packages) && count($result->packages) == count($packages));
119197
120198
// generate speedlabel
@@ -150,6 +228,8 @@ public function test_add_packages()
150228
151229
}
152230
231+
232+
153233
154234
public function test_post_code()
155235
{
@@ -170,6 +250,15 @@ public function test_post_code()
170250
$pc5 = $dpd->checkPostCode('00-000');
171251
$this->assertFalse(isset($pc5->status) && $pc5->status == 'OK');
172252
253+
}*/
254+
255+
public function test_courier_availability()
256+
{
257+
$dpd = new DPDService();
258+
259+
$pc = $dpd->checkCourierAvailability('33-100');
260+
$this->assertTrue(isset($pc->status) && $pc->status == 'OK');
261+
173262
}
174263

175264
}

0 commit comments

Comments
 (0)