Skip to content

Commit

Permalink
Bugfix: A canceled order would result in an exception
Browse files Browse the repository at this point in the history
  • Loading branch information
michielgerritsen committed Aug 7, 2019
1 parent fe20a2b commit 67b0687
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Helper/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ public function registerCancellation(OrderInterface $order, $status = null)
$this->addTolog('info', $order->getIncrementId() . ' ' . $comment);
$this->orderCommentHistory->add($order, $comment);
$order->getPayment()->setMessage($comment);
$this->orderManagement->cancel($order);
$this->orderManagement->cancel($order->getId());

if ($order->getCouponCode()) {
$this->resetCouponAfterCancellation($order);
Expand Down
2 changes: 1 addition & 1 deletion Test/Unit/Helper/GeneralTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public function testRegisterCancellationReturnsFalseWhenAlreadyCanceled()
public function testRegisterCancellationCancelsTheOrder()
{
$orderManagementMock = $this->createMock(OrderManagementInterface::class);
$orderManagementMock->expects($this->once())->method('cancel');
$orderManagementMock->expects($this->once())->method('cancel')->with(999);

/** @var OrderModel $order */
$order = $this->createPartialMock(OrderModel::class, ['cancel']);
Expand Down

0 comments on commit 67b0687

Please sign in to comment.