-
-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added test case for multiple paymentrecords check
- Loading branch information
1 parent
9e1bac4
commit cff4814
Showing
2 changed files
with
101 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
tests/phpunit/CRM/Event/Form/Registration/ConfirmMultipleParticipantTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
/** | ||
* Test CRM_Event_Form_Registration functions. | ||
* | ||
* @package CiviCRM | ||
* @group headless | ||
*/ | ||
class CRM_Event_Form_Registration_ConfirmTest extends CiviUnitTestCase { | ||
|
||
public function setUp() { | ||
$this->useTransaction(TRUE); | ||
parent::setUp(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -584,4 +584,89 @@ public function testNoteSubmission() { | |
list($contact_id, $participant_id) = $this->submitWithNote($event, $contact_id); | ||
} | ||
|
||
/** | ||
* Test for Multiple participant. | ||
*/ | ||
public function testMultipleParticipant() { | ||
$params = ['is_monetary' => 1, 'financial_type_id' => 1]; | ||
$event = $this->eventCreate($params); | ||
CRM_Event_Form_Registration_Confirm::testSubmit([ | ||
'id' => $event['id'], | ||
'contributeMode' => 'direct', | ||
'registerByID' => $this->createLoggedInUser(), | ||
'totalAmount' => 440, | ||
'event' => reset($event['values']), | ||
'params' => [ | ||
[ | ||
'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801', | ||
'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&id={$event['id']}", | ||
'first_name' => 'Participant1', | ||
'last_name' => 'LastName', | ||
'email-Primary' => '[email protected]', | ||
'additional_participants' => 2, | ||
'payment_processor_id' => 0, | ||
'bypass_payment' => '', | ||
'MAX_FILE_SIZE' => '33554432', | ||
'is_primary' => 1, | ||
'is_pay_later' => 1, | ||
'campaign_id' => NULL, | ||
'defaultRole' => 1, | ||
'participant_role_id' => '1', | ||
'currencyID' => 'USD', | ||
'amount_level' => 'Tiny-tots (ages 5-8) - 1', | ||
'amount' => '100.00', | ||
'tax_amount' => 10, | ||
'ip_address' => '127.0.0.1', | ||
'invoiceID' => '57adc34957a29171948e8643ce906332', | ||
'trxn_id' => '123456789', | ||
'button' => '_qf_Register_upload', | ||
], | ||
[ | ||
'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801', | ||
'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&id={$event['id']}", | ||
'first_name' => 'Participant2', | ||
'last_name' => 'LastName', | ||
'email-Primary' => '[email protected]', | ||
'scriptFee' => '', | ||
'scriptArray' => '', | ||
'campaign_id' => NULL, | ||
'is_pay_later' => 1, | ||
'participant_role_id' => '1', | ||
'currencyID' => 'USD', | ||
'amount_level' => 'Tiny-tots (ages 9-18) - 1', | ||
'amount' => '200.00', | ||
'tax_amount' => 20, | ||
], | ||
[ | ||
'qfKey' => 'e6eb2903eae63d4c5c6cc70bfdda8741_2801', | ||
'entryURL' => "http://dmaster.local/civicrm/event/register?reset=1&id={$event['id']}", | ||
'first_name' => 'Participant3', | ||
'last_name' => 'LastName', | ||
'email-Primary' => '[email protected]', | ||
'scriptFee' => '', | ||
'scriptArray' => '', | ||
'campaign_id' => NULL, | ||
'is_pay_later' => 1, | ||
'participant_role_id' => '1', | ||
'currencyID' => 'USD', | ||
'amount_level' => 'Tiny-tots (ages 5-8) - 1', | ||
'amount' => '100.00', | ||
'tax_amount' => 10, | ||
], | ||
], | ||
]); | ||
$participants = $this->callAPISuccess('Participant', 'get', [])['values']; | ||
$participantsPayment = $this->callAPISuccess('ParticipantPayment', 'get', [])['values']; | ||
|
||
$ids_participant = array_column($participants, 'participant_id'); | ||
|
||
$ids_payment_participant = array_column($participantsPayment, 'participant_id'); | ||
if ($ids_participant == $ids_payment_participant) { | ||
$this->assertTrue(TRUE); | ||
} | ||
else { | ||
$this->assertFalse(TRUE); | ||
} | ||
} | ||
|
||
} |