Skip to content

Commit

Permalink
CC-7923 Adjust test
Browse files Browse the repository at this point in the history
  • Loading branch information
AsonUnique committed Mar 13, 2020
1 parent 07f4991 commit ca5ff3c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions tests/SprykerTest/Zed/Oms/Business/OmsFacadeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ public function testTriggerEventWillNotThrowAnExceptionWhenExceptionWasThrownDur
//Arrange
$testStateMachineProcessName = 'Test02';
$omsFacade = $this->createOmsFacadeWithErroredTestStateMachine([$testStateMachineProcessName]);

$saveOrderTransfer1 = $this->tester->haveOrder([
'unitPrice' => 100,
'sumPrice' => 100,
Expand All @@ -187,33 +188,37 @@ public function testTriggerEventWillNotThrowAnExceptionWhenExceptionWasThrownDur
'unitPrice' => 100,
'sumPrice' => 100,
], $testStateMachineProcessName);

$orderItems = SpySalesOrderItemQuery::create()
->filterByFkSalesOrder_In([
$saveOrderTransfer1->getIdSalesOrder(),
$saveOrderTransfer2->getIdSalesOrder(),
])
->orderByIdSalesOrderItem(Criteria::ASC)
->find();

//Act
$omsFacade->triggerEvent('authorize', clone $orderItems, []);

//Assert
$processedOrderItems = SpySalesOrderItemQuery::create()
->filterByFkSalesOrder_In([
$saveOrderTransfer1->getIdSalesOrder(),
$saveOrderTransfer2->getIdSalesOrder(),
])
->orderByIdSalesOrderItem(Criteria::ASC)
->find();
//Assert

$this->assertEquals(
$orderItems->shift()->getFkOmsOrderItemState(),
$processedOrderItems->shift()->getFkOmsOrderItemState()
$orderItems->offsetGet(0)->getFkOmsOrderItemState(),
$processedOrderItems->offsetGet(0)->getFkOmsOrderItemState(),
'Order item state ID does not equal to an expected value.'
);
$this->assertNotEquals(
$orderItems->offsetGet(1)->getFkOmsOrderItemState(),
$processedOrderItems->offsetGet(1)->getFkOmsOrderItemState(),
'Order item state ID does not equal to an expected value.'
);
while ($orderItems->count()) {
$this->assertNotEquals(
$orderItems->shift()->getFkOmsOrderItemState(),
$processedOrderItems->shift()->getFkOmsOrderItemState()
);
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/_data/state-machine/Test02.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="spryker:oms-01 http://static.spryker.com/oms-01.xsd">

<process name="Test03" main="true">
<process name="Test02" main="true">

<states>
<state name="new" reserved="true"/>
Expand Down

0 comments on commit ca5ff3c

Please sign in to comment.