From 9da1057134e1c9fa7e90554b886e97c7c8df1db2 Mon Sep 17 00:00:00 2001 From: JKingsnorth Date: Tue, 5 Jul 2016 11:30:03 +0100 Subject: [PATCH] CRM-18186: Tests for getting participants by registered_by_id --- tests/phpunit/api/v3/ParticipantTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/phpunit/api/v3/ParticipantTest.php b/tests/phpunit/api/v3/ParticipantTest.php index 30cfe76f0654..b46b253151e7 100644 --- a/tests/phpunit/api/v3/ParticipantTest.php +++ b/tests/phpunit/api/v3/ParticipantTest.php @@ -69,6 +69,7 @@ public function setUp() { $this->_participantID2 = $this->participantCreate(array( 'contact_id' => $this->_contactID2, 'event_id' => $this->_eventID, + 'registered_by_id' => $this->_participantID, )); $this->_participantID3 = $this->participantCreate(array( 'contact_id' => $this->_contactID2, @@ -343,6 +344,19 @@ public function testSearchByEventWithLimit() { $this->assertEquals($participant['count'], 2); } + /** + * Test search by lead booker (registered by ID) + */ + public function testSearchByRegisteredById() { + $params = array( + 'registered_by_id' => $this->_participantID, + ); + $participant = $this->callAPISuccess('participant', 'get', $params); + + $this->assertEquals($participant['count'], 1); + $this->assertEquals($participant['id'], $this->_participantID2); + } + ///////////////// civicrm_participant_create methods /**