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']); } }