From 13acdb100a37189db5fbea76d5bf8e0ffb9a1b38 Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Fri, 21 Aug 2020 11:43:32 +0100 Subject: [PATCH] Add test that we can set 'Pending from Approval' for participant status via Order API --- tests/phpunit/api/v3/OrderTest.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/phpunit/api/v3/OrderTest.php b/tests/phpunit/api/v3/OrderTest.php index 337f2c54e314..68511e9ac73b 100644 --- a/tests/phpunit/api/v3/OrderTest.php +++ b/tests/phpunit/api/v3/OrderTest.php @@ -347,6 +347,7 @@ public function testAddOrderForParticipant() { 'role_id' => 1, 'register_date' => '2007-07-21 00:00:00', 'source' => 'Online Event Registration: API Testing', + 'participant_status_id' => 'Pending from approval', ], ]; @@ -358,12 +359,15 @@ public function testAddOrderForParticipant() { 'net_amount' => 600, ], ]; - $paymentParticipant = [ + $orderParams = [ 'contribution_id' => $order['id'], ]; - $order = $this->callAPISuccess('order', 'get', $paymentParticipant); + $order = $this->callAPISuccess('order', 'get', $orderParams); $this->checkPaymentResult($order, $expectedResult); - $this->callAPISuccessGetCount('ParticipantPayment', $paymentParticipant, 2); + $paymentParticipant = $this->callAPISuccess('ParticipantPayment', 'get', $orderParams)['values']; + $this->assertEquals(2, count($paymentParticipant), 'Expected two participant payments'); + $participant = $this->callAPISuccessGetSingle('Participant', ['participant_id' => end($paymentParticipant)['participant_id']]); + $this->assertEquals('Pending from approval', $participant['participant_status']); $this->callAPISuccess('Contribution', 'Delete', [ 'id' => $order['id'], ]);