Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Make date for Order::withNumberAndDate() optional
Browse files Browse the repository at this point in the history
Fix #42
  • Loading branch information
sanmai committed Apr 19, 2019
1 parent 390cb57 commit 05a414b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Common/Order.php
Expand Up @@ -52,7 +52,7 @@ public static function withDispatchNumber(string $DispatchNumber): Order
]);
}

public static function withNumberAndDate(string $Number, \DateTimeInterface $Date): Order
public static function withNumberAndDate(string $Number, \DateTimeInterface $Date = null): Order
{
return Order::create([
'Number' => $Number,
Expand Down
11 changes: 11 additions & 0 deletions tests/Serialization/OrderTest.php
Expand Up @@ -164,6 +164,17 @@ public function test_can_serialize_with_delivery_surcharge()
<DeliveryRecipientCostAdv Threshold="2000" Sum="150" VATRate="vat10" VATSum="45.906"/>
<AddService ServiceCode="30"/>
</Order>
', $order);
}

public function test_order_with_number_only()
{
$order = Order::withNumberAndDate('ORD-123');

$this->assertSame('ORD-123', $order->getNumber());

$this->assertSameAsXML('<?xml version="1.0" encoding="UTF-8"?>
<Order Number="ORD-123"/>
', $order);
}
}

0 comments on commit 05a414b

Please sign in to comment.