Skip to content

Commit c9f5ca5

Browse files
committed
MAGETWO-54042: Order Status is Set to Processing when Vitual Product is Purchased by Payment that Automatically Captures Funds
- Added fix from support team with required tests;
1 parent 758b743 commit c9f5ca5

File tree

2 files changed

+9
-9
lines changed
  • app/code/Magento/Sales

2 files changed

+9
-9
lines changed

app/code/Magento/Sales/Model/ResourceModel/Order/Handler/State.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ class State
2323
*/
2424
public function check(Order $order)
2525
{
26-
if (!$order->getId()) {
27-
return $order;
28-
}
2926
if (!$order->isCanceled() && !$order->canUnhold() && !$order->canInvoice() && !$order->canShip()) {
3027
if (0 == $order->getBaseGrandTotal() || $order->canCreditmemo()) {
3128
if ($order->getState() !== Order::STATE_COMPLETE) {

app/code/Magento/Sales/Test/Unit/Model/ResourceModel/Order/Handler/StateTest.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,20 @@ protected function setUp()
7474
public function testCheckOrderEmpty()
7575
{
7676
$this->orderMock->expects($this->once())
77-
->method('getId')
78-
->will($this->returnValue(null));
79-
$this->assertEquals($this->orderMock, $this->state->check($this->orderMock));
77+
->method('getBaseGrandTotal')
78+
->willReturn(100);
79+
$this->orderMock->expects($this->never())
80+
->method('setState');
81+
82+
$this->state->check($this->orderMock);
8083
}
8184

8285
/**
8386
* test check order - set state complete
8487
*/
8588
public function testCheckSetStateComplete()
8689
{
87-
$this->orderMock->expects($this->once())
90+
$this->orderMock->expects($this->any())
8891
->method('getId')
8992
->will($this->returnValue(1));
9093
$this->orderMock->expects($this->once())
@@ -120,7 +123,7 @@ public function testCheckSetStateComplete()
120123
*/
121124
public function testCheckSetStateClosed()
122125
{
123-
$this->orderMock->expects($this->once())
126+
$this->orderMock->expects($this->any())
124127
->method('getId')
125128
->will($this->returnValue(1));
126129
$this->orderMock->expects($this->once())
@@ -162,7 +165,7 @@ public function testCheckSetStateClosed()
162165
*/
163166
public function testCheckSetStateProcessing()
164167
{
165-
$this->orderMock->expects($this->once())
168+
$this->orderMock->expects($this->any())
166169
->method('getId')
167170
->will($this->returnValue(1));
168171
$this->orderMock->expects($this->once())

0 commit comments

Comments
 (0)