Skip to content

Commit

Permalink
test: update coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine authored and myparcel-bot[bot] committed Oct 27, 2023
1 parent 0892d3e commit ad3fbd6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
6 changes: 5 additions & 1 deletion tests/Unit/Fulfilment/Repository/PostOrdersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ function () {

'order with drop-off point' => [
function () {
return factory(PdkOrderCollection::class)->push(factory(PdkOrder::class)->withShipments());
return factory(PdkOrderCollection::class)->push(
factory(PdkOrder::class)->withShipments([
factory(Shipment::class)->withDropOffPoint(),
])
);
},
],

Expand Down
12 changes: 1 addition & 11 deletions tests/factories/Fulfilment/Model/ShipmentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
use MyParcelNL\Pdk\Shipment\Model\RetailLocation;
use MyParcelNL\Pdk\Shipment\Model\RetailLocationFactory;
use MyParcelNL\Pdk\Tests\Factory\Model\AbstractModelFactory;
use function MyParcelNL\Pdk\Tests\factory;

/**
* @template T of Shipment
* @method Shipment make()
* @method $this withCarrier(int $carrier)
* @method $this withContractId(string $contractId)
* @method $this withCustomsDeclaration(CustomsDeclaration|CustomsDeclarationFactory $customsDeclaration)
* @method $this withDropOffPoint(RetailLocation|RetailLocationFactory $dropOffPoint)
* @method $this withOptions(ShipmentOptions|ShipmentOptionsFactory $options)
* @method $this withPhysicalProperties(PhysicalProperties|PhysicalPropertiesFactory $physicalProperties)
* @method $this withPickup(RetailLocation|RetailLocationFactory $pickup)
Expand All @@ -33,14 +33,4 @@ public function getModel(): string
{
return Shipment::class;
}

/**
* @param array|RetailLocation|RetailLocationFactory $dropOffPoint
*
* @return $this
*/
public function withDropOffPoint($dropOffPoint = null): self
{
return $this->with(['dropOffPoint' => $dropOffPoint ?? factory(RetailLocation::class)]);
}
}
11 changes: 10 additions & 1 deletion tests/factories/Shipment/Model/ShipmentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
* @method $this withDeleted(string|DateTime $deleted)
* @method $this withDelivered(bool $delivered)
* @method $this withDeliveryOptions(array|DeliveryOptions|DeliveryOptionsFactory|DeliveryOptionsFactory|DeliveryOptionsFactory $deliveryOptions)
* @method $this withDropOffPoint(array|RetailLocation|RetailLocationFactory|RetailLocationFactory $dropOffPoint)
* @method $this withExternalIdentifier(string $externalIdentifier)
* @method $this withHidden(bool $hidden)
* @method $this withIsReturn(bool $isReturn)
Expand Down Expand Up @@ -68,6 +67,16 @@ public function withDeliveryOptionsWithPickupLocation(): self
return $this->withDeliveryOptions(factory(DeliveryOptions::class)->withPickupLocation());
}

/**
* @param array|RetailLocation|RetailLocationFactory $dropOffPoint
*
* @return $this
*/
public function withDropOffPoint($dropOffPoint = null): self
{
return $this->with(['dropOffPoint' => $dropOffPoint ?? factory(RetailLocation::class)]);
}

/**
* @param null|int $id
*
Expand Down

0 comments on commit ad3fbd6

Please sign in to comment.