Skip to content

Commit

Permalink
Merge branch 'master' into order_v4_add_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
h2rd authored Mar 8, 2024
2 parents f498a7e + e591c74 commit e3955db
Show file tree
Hide file tree
Showing 20 changed files with 2,130 additions and 9 deletions.
40 changes: 38 additions & 2 deletions UnitTestFiles/Test/OrderTests.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ public function testToArray()
'name' => 'Bill Soul',
],
],
]
);
],
]);
}

public function testGetOrders()
Expand Down Expand Up @@ -253,6 +253,8 @@ public function testAddOrdersToOptimization()

public function testAddOrdersToRoute()
{
$this->markTestSkipped('Read old data.');

$body = json_decode(file_get_contents(dirname(__FILE__).'/data/add_order_to_route_data.json'), true);

$routeId = self::$createdProblems[0]->routes[0]->route_id;
Expand Down Expand Up @@ -350,6 +352,23 @@ public function testGetOrderByID()
self::assertInstanceOf(Order::class, Order::fromArray($response));
}

public function testGetOrderByUUID()
{
$order = new Order();

$orderUUID = self::$createdOrders[0]['order_uuid'];

// Get an order
$orderParameters = Order::fromArray([
'order_id' => $orderUUID,
]);

$response = $order->getOrder($orderParameters);

self::assertNotNull($response);
self::assertInstanceOf(Order::class, Order::fromArray($response));
}

public function testGetOrderByInsertedDate()
{
$orderParameters = Order::fromArray([
Expand Down Expand Up @@ -517,6 +536,23 @@ public function testUpdateOrderWithCustomFiel()
$this->assertEquals(true, $response['custom_user_fields'][0]['order_custom_field_value']);
}

public function testDeleteOrderByUuid()
{
$lastOrder = array_pop(self::$createdOrders);
if ($lastOrder != null) {
$order = new Order();
$ids = [
"order_ids" => [$lastOrder['order_uuid']]
];

$response = $order->removeOrder($ids);

if (!is_null($response) && isset($response['status']) && $response['status']) {
echo "The test order removed by UUID <br>";
}
}
}

public static function tearDownAfterClass()
{
if (sizeof(self::$createdOrders)) {
Expand Down
Loading

0 comments on commit e3955db

Please sign in to comment.