Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 8cae87e

Browse files
author
Jens Schulze
committed
test(Order): fix order integration tests
1 parent 6fab77b commit 8cae87e

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

src/Model/Order/OrderState.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
class OrderState
1313
{
1414
const OPEN = 'Open';
15+
const CONFIRMED = 'Confirmed';
1516
const COMPLETE = 'Complete';
1617
const CANCELLED = 'Cancelled';
1718
}

tests/integration/ApiTestCase.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,13 @@ protected function getChannelDraft()
834834
return $draft;
835835
}
836836

837-
protected function getChannel()
837+
protected function getChannel($roles = null)
838838
{
839839
if (is_null($this->channel)) {
840840
$draft = $this->getChannelDraft();
841+
if (is_array($roles)) {
842+
$draft->setRoles($roles);
843+
}
841844
$request = ChannelCreateRequest::ofDraft($draft);
842845
$response = $request->executeWithClient($this->getClient());
843846
$this->channel = $request->mapResponse($response);

tests/integration/Order/OrderUpdateRequestTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function testChangeState()
108108

109109
$this->assertNotSame($order->getVersion(), $result->getVersion());
110110
$this->assertInstanceOf('\Commercetools\Core\Model\Order\Order', $result);
111-
$this->assertSame(OrderState::COMPLETE, $result->getState());
111+
$this->assertSame(OrderState::COMPLETE, $result->getOrderState());
112112
}
113113

114114
public function testChangeShipmentState()
@@ -150,7 +150,7 @@ public function testUpdateSyncInfo()
150150
$cartDraft = $this->getCartDraft();
151151
$order = $this->createOrder($cartDraft);
152152

153-
$channel = $this->getChannel();
153+
$channel = $this->getChannel(['OrderExport']);
154154
$syncedAt = new \DateTime();
155155
$request = OrderUpdateRequest::ofIdAndVersion($order->getId(), $order->getVersion())
156156
->addAction(OrderUpdateSyncInfoAction::ofChannel($channel->getReference())->setSyncedAt($syncedAt))
@@ -264,12 +264,12 @@ public function testAddDelivery()
264264
$this->assertNotSame($order->getVersion(), $result->getVersion());
265265
$this->assertInstanceOf('\Commercetools\Core\Model\Order\Order', $result);
266266
$delivery = $result->getShippingInfo()->getDeliveries()->current();
267-
$this->assertSame($lineItem->getId(), $delivery->getId());
267+
$this->assertSame($lineItem->getId(), $delivery->getItems()->current()->getId());
268268
$order = $result;
269269

270270
$request = OrderUpdateRequest::ofIdAndVersion($order->getId(), $order->getVersion())
271271
->addAction(
272-
OrderAddParcelToDeliveryAction::ofDeliveryId($delivery)
272+
OrderAddParcelToDeliveryAction::ofDeliveryId($delivery->getId())
273273
->setMeasurements(
274274
ParcelMeasurements::of()
275275
->setHeightInMillimeter(100)

0 commit comments

Comments
 (0)