Skip to content

Commit

Permalink
Merge pull request #6 from answear/dressing-room
Browse files Browse the repository at this point in the history
Add "Dressing Room" service
  • Loading branch information
malarzm authored May 14, 2021
2 parents 125b886 + 03a9dc9 commit 3421e10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Enum/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class Service extends Enum
public const ROD = 'P20';
public const TYRES = 'P30';
public const PALLET = 'P90';
public const DRESSING_ROOM = '10001';

public static function delivery(): self
{
Expand Down Expand Up @@ -62,4 +63,9 @@ public static function pallet(): self
{
return static::get(static::PALLET);
}

public static function dressingRoom(): self
{
return static::get(static::DRESSING_ROOM);
}
}
5 changes: 5 additions & 0 deletions src/ValueObject/AdditionalInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,9 @@ class AdditionalInfo
public array $services = [];
public bool $wheelchairAccessible;
public bool $parking;

public function hasService(Service $service): bool
{
return \in_array($service, $this->services, true);
}
}
5 changes: 5 additions & 0 deletions tests/Service/PUDOFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Answear\DpdPlPickupServicesBundle\Tests\Service;

use Answear\DpdPlPickupServicesBundle\Enum\Day;
use Answear\DpdPlPickupServicesBundle\Enum\Service;
use Answear\DpdPlPickupServicesBundle\Enum\Type;
use Answear\DpdPlPickupServicesBundle\Service\PUDOFactory;
use Answear\DpdPlPickupServicesBundle\ValueObject\Coordinates;
Expand Down Expand Up @@ -42,6 +43,10 @@ public function dataIsCorrect(): void
self::assertSame('POL', $pudo->address->country);
self::assertEquals(new Coordinates(50.05874, 19.97894), $pudo->coordinates);
self::assertCount(3, $pudo->additionalInfo->services);
self::assertTrue($pudo->additionalInfo->hasService(Service::delivery()));
self::assertTrue($pudo->additionalInfo->hasService(Service::dropoffOnline()));
self::assertTrue($pudo->additionalInfo->hasService(Service::dropoffOffline()));
self::assertFalse($pudo->additionalInfo->hasService(Service::swap()));
self::assertTrue($pudo->additionalInfo->parking);
self::assertFalse($pudo->additionalInfo->wheelchairAccessible);
foreach ($pudo->opened as $day => $openings) {
Expand Down

0 comments on commit 3421e10

Please sign in to comment.