Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1405dec

Browse files
authored
Merge pull request #9578 from lchrusciel/bc-fix
[Core] Nullable customer on order
2 parents 254cc10 + 61a5b19 commit 1405dec

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

src/Sylius/Component/Core/Model/Order.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function getCustomer(): ?BaseCustomerInterface
126126
*/
127127
public function setCustomer(?BaseCustomerInterface $customer): void
128128
{
129-
Assert::isInstanceOf($customer, CustomerInterface::class);
129+
Assert::nullOrisInstanceOf($customer, CustomerInterface::class);
130130

131131
$this->customer = $customer;
132132
}

src/Sylius/Component/Core/spec/Model/OrderSpec.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ function its_allows_defining_customer(CustomerInterface $customer): void
5252
$this->getCustomer()->shouldReturn($customer);
5353
}
5454

55+
function its_customer_can_be_nullable(): void
56+
{
57+
$this->setCustomer(null);
58+
$this->getCustomer()->shouldReturn(null);
59+
}
60+
5561
function its_channel_is_mutable(ChannelInterface $channel): void
5662
{
5763
$this->setChannel($channel);

0 commit comments

Comments
 (0)