-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathConsignmentOtherOptionsTest.php
109 lines (100 loc) · 4.97 KB
/
ConsignmentOtherOptionsTest.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
declare(strict_types=1);
namespace MyParcelNL\Sdk\Test\Model\Consignment;
use MyParcelNL\Sdk\src\Model\Consignment\AbstractConsignment;
use MyParcelNL\Sdk\Test\Bootstrap\ConsignmentTestCase;
class ConsignmentOtherOptionsTest extends ConsignmentTestCase
{
/**
* @return array
* @throws \Exception
*/
public static function provideAutoDetectPickupData(): array
{
$instance = new self();
$deliveryDate = $instance->generateDeliveryDate();
return $instance->createConsignmentProviderDataset(
[
'Auto detect pickup' => [
'checkout_data' => sprintf(
'{"date":"%s","time":[{"start":"16:00:00","type":4,"price":{"currency":"EUR","amount":0}}],"location":"Primera Sanders","street":"Polderplein","number":"3","postal_code":"2132BA","city":"Hoofddorp","cc":"NL","start_time":"16:00:00","price":0,"price_comment":"retail","comment":"Dit is een Postkantoor. Post en pakketten die u op werkdagen vóór de lichtingstijd afgeeft, bezorgen we binnen Nederland de volgende dag. Op zaterdag worden alléén pakketten die u afgeeft voor 15:00 uur maandag bezorgd.","phone_number":"","opening_hours":{"monday":["11:00-18:00"],"tuesday":["09:00-18:00"],"wednesday":["09:00-18:00"],"thursday":["09:00-18:00"],"friday":["09:00-21:00"],"saturday":["09:00-18:00"],"sunday":["12:00-17:00"]},"distance":"312","latitude":"52.30329367","longitude":"4.69476214","location_code":"176227","retail_network_id":"PNPNL-01","holiday":[]}',
$deliveryDate
),
self::AUTO_DETECT_PICKUP => true,
self::expected(self::DELIVERY_TYPE) => AbstractConsignment::DELIVERY_TYPE_PICKUP,
self::expected(self::DELIVERY_DATE) => $deliveryDate,
],
]
);
}
/**
* @return array
* @throws \Exception
* @deprecated
*/
public static function provideCheckoutDataData(): array
{
$instance = new self();
$deliveryDate = $instance->generateDeliveryDate();
return $instance->createConsignmentProviderDataset([
'[DEPRECATED] checkout data' => [
'checkout_data' => sprintf(
'{"date":"%s","time":[{"start":"16:00:00","type":4,"price":{"currency":"EUR","amount":0}}],"location":"Primera Sanders","street":"Polderplein","number":"3","postal_code":"2132BA","city":"Hoofddorp","cc":"NL","start_time":"16:00:00","price":0,"price_comment":"retail","comment":"Dit is een Postkantoor. Post en pakketten die u op werkdagen vóór de lichtingstijd afgeeft, bezorgen we binnen Nederland de volgende dag. Op zaterdag worden alléén pakketten die u afgeeft voor 15:00 uur maandag bezorgd.","phone_number":"","opening_hours":{"monday":["11:00-18:00"],"tuesday":["09:00-18:00"],"wednesday":["09:00-18:00"],"thursday":["09:00-18:00"],"friday":["09:00-21:00"],"saturday":["09:00-18:00"],"sunday":["12:00-17:00"]},"distance":"312","latitude":"52.30329367","longitude":"4.69476214","location_code":"176227","retail_network_id":"PNPNL-01","holiday":[]}',
$deliveryDate
),
self::expected(self::DELIVERY_DATE) => $deliveryDate,
self::expected(self::DELIVERY_TYPE) => AbstractConsignment::DELIVERY_TYPE_PICKUP,
self::expected(self::PICKUP_CITY) => 'Hoofddorp',
self::expected(self::PICKUP_COUNTRY) => AbstractConsignment::CC_NL,
self::expected(self::PICKUP_LOCATION_NAME) => 'Primera Sanders',
self::expected(self::PICKUP_NUMBER) => '3',
self::expected(self::PICKUP_POSTAL_CODE) => '2132BA',
self::expected(self::PICKUP_STREET) => 'Polderplein',
],
]);
}
/**
* @return array
* @throws \Exception
*/
public static function provideSaveRecipientAddressData(): array
{
return (new self())->createConsignmentProviderDataset([
'Save recipient address' => [
self::SAVE_RECIPIENT_ADDRESS => true,
],
]);
}
/**
* @param array $testData
*
* @throws \Exception
* @dataProvider provideAutoDetectPickupData
*/
public function testAutoDetectPickup(array $testData): void
{
$this->doConsignmentTest($testData);
}
/**
* @param array $testData
*
* @throws \Exception
* @dataProvider provideCheckoutDataData
* @todo fix test
*/
public function testCheckoutData(array $testData): void
{
self::markTestBroken();
$this->doConsignmentTest($testData);
}
/**
* @param array $testData
*
* @throws \Exception
* @dataProvider provideSaveRecipientAddressData
*/
public function testSaveRecipientAddress(array $testData): void
{
$this->doConsignmentTest($testData);
}
}