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)); # check that administrator has one action pending $this->assertEquals(sizeof($next_steps), 1); $pending_step = $next_steps[0]; $this->assertTrue(is_array($pending_step)); $this->assertArrayHasKey('idOrder', $pending_step); $this->assertArrayHasKey('orderNumber', $pending_step); $this->assertArrayHasKey('status', $pending_step); $this->assertArrayHasKey('stepAction', $pending_step); $this->assertEquals($pending_step['idOrder'], $this->order_id); $this->assertEquals($pending_step['orderNumber'], $this->order_id); $this->assertEquals($pending_step['status'], 'pending'); $this->assertNotEmpty($pending_step['stepAction']); } }