Files
old-new-wiaas/backend/app/plugins/wiaas/tests/unit-tests/test-wiaas-rest-delivery-process-api.php
2018-08-14 12:12:54 +02:00

53 lines
1.3 KiB
PHP

<?php
/**
* Wiaas_Delivery_Process_Step_Test
*
* @package Wiaas
*/
class Wiass_REST_Delivery_Process_Api_Test extends Wiaas_Unit_Test_Case {
var $order_id, $api;
function setUp() {
parent::setUp();
$order = wc_create_order();
$this->order_id = $order->get_id();
wp_set_current_user(1);
}
/**
* @covers Wiass_REST_Delivery_Process_API::get_next_actions_for_user
*/
function test_get_next_actions_for_user() {
wp_set_current_user(1);
$response = Wiass_REST_Delivery_Process_API::get_next_actions_for_user();
$this->assertNotNull($response);
$this->assertInstanceOf('WP_REST_Response', $response);
$next_steps = $response->get_data();
$this->assertNotNull($next_steps);
$this->assertTrue(is_array($next_steps));
$pending_step = $next_steps[0];
$this->assertTrue(is_array($pending_step));
$this->assertArrayHasKey('order_id', $pending_step);
$this->assertArrayHasKey('order_number', $pending_step);
$this->assertArrayHasKey('status', $pending_step);
$this->assertArrayHasKey('step_action', $pending_step);
$this->assertEquals($pending_step['order_id'], $this->order_id);
$this->assertEquals($pending_step['order_number'], $this->order_id);
$this->assertEquals($pending_step['status'], 'pending');
$this->assertNotEmpty($pending_step['step_action']);
}
}