Skip to content

Commit

Permalink
Add parcel property to ParcelShop DTO
Browse files Browse the repository at this point in the history
  • Loading branch information
konradkozaczenko committed Feb 9, 2022
1 parent 42db565 commit 7a916c9
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Response/DTO/ParcelShop.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ParcelShop
public int $centerId;
public string $shortName;
public string $remark = '';
public ?string $partner = null;
public ?bool $delivery;
public ?bool $dropoff;
public Address $address;
Expand Down
4 changes: 2 additions & 2 deletions src/Serializer/CamelCaseToPascalCaseNameConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@

class CamelCaseToPascalCaseNameConverter implements NameConverterInterface
{
public function normalize($propertyName)
public function normalize($propertyName): string
{
return ucfirst($propertyName);
}

/**
* {@inheritdoc}
*/
public function denormalize($propertyName)
public function denormalize($propertyName): string
{
$doubleU = preg_replace_callback(
'/[A-Z]{2,}/',
Expand Down
5 changes: 5 additions & 0 deletions src/Serializer/Normalizer/EnumNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

class EnumNormalizer implements NormalizerInterface, DenormalizerInterface
{
/**
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function normalize($object, $format = null, array $context = [])
{
if (!$object instanceof Enum) {
Expand Down Expand Up @@ -38,6 +41,8 @@ public function supportsDenormalization($data, $type, $format = null): bool

/**
* @see Enum for $type
*
* @return array|string|int|float|bool|\ArrayObject|null
*/
public function denormalize($data, $type, $format = null, array $context = [])
{
Expand Down
1 change: 1 addition & 0 deletions tests/Integration/Service/ParcelShopsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ private function assertOfficeSame(array $parcelShops): void
],
'remark' => $parcelShop->remark,
'shortName' => $parcelShop->shortName,
'partner' => $parcelShop->partner,
'address' => [
'name' => $address->name,
'addressId' => $address->addressId,
Expand Down
5 changes: 5 additions & 0 deletions tests/Integration/Service/data/parcelShops.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"Dropoff": false,
"GeoLat": 45.97585870,
"GeoLong": 17.17087710,
"Partner": "BOSO",
"Address": {
"Name": "BS KLOŠTAR PODRAVSKI",
"ZipCode": "48362",
Expand Down Expand Up @@ -106,6 +107,7 @@
"Dropoff": true,
"GeoLat": 45.75366760,
"GeoLong": 15.89560960,
"Partner": "iNOVINE",
"Address": {
"Name": "POSLOVNICA",
"ZipCode": "10251",
Expand Down Expand Up @@ -135,6 +137,7 @@
"Dropoff": true,
"GeoLat": 45.89170900,
"GeoLong": 16.83863500,
"Partner": "iNOVINE",
"Address": {
"Name": "POSLOVNICA",
"ZipCode": "43000",
Expand Down Expand Up @@ -162,6 +165,7 @@
"Dropoff": false,
"GeoLat": 45.23975990,
"GeoLong": 13.93730920,
"Partner": "BOSO",
"Address": {
"Name": "IN974",
"ZipCode": "52000",
Expand Down Expand Up @@ -203,6 +207,7 @@
"Dropoff": false,
"GeoLat": 44.53436667,
"GeoLong": 14.91296667,
"Partner": "iNOVINE",
"Address": {
"Name": "BS KOLAN PAG",
"ZipCode": "53291",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"remark": "",
"shortName": "CR3403",
"partner": "BOSO",
"address": {
"name": "BS KLO\u0160TAR PODRAVSKI",
"addressId": null,
Expand Down Expand Up @@ -58,6 +59,7 @@
},
"remark": "",
"shortName": "IN702",
"partner": null,
"address": {
"name": "IN702",
"addressId": null,
Expand Down Expand Up @@ -124,6 +126,7 @@
},
"remark": "ISPORUKE I PREUZIMANJA U POSLOVNICI, neaktivno",
"shortName": "OEXZG",
"partner": "iNOVINE",
"address": {
"name": "POSLOVNICA",
"addressId": null,
Expand Down Expand Up @@ -160,6 +163,7 @@
},
"remark": "",
"shortName": "OEXBJ",
"partner": "iNOVINE",
"address": {
"name": "POSLOVNICA",
"addressId": null,
Expand Down Expand Up @@ -196,6 +200,7 @@
},
"remark": "",
"shortName": "IN974",
"partner": "BOSO",
"address": {
"name": "IN974",
"addressId": null,
Expand Down Expand Up @@ -244,6 +249,7 @@
},
"remark": "",
"shortName": "TF035",
"partner": "iNOVINE",
"address": {
"name": "BS KOLAN PAG",
"addressId": null,
Expand Down

0 comments on commit 7a916c9

Please sign in to comment.