File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ private static function updateContributionStatus($contributionId) {
1919 $ contribution = \Civi \Api4 \Contribution::get (FALSE )
2020 ->addWhere ('id ' , '= ' , $ contributionId )
2121 ->addWhere ('contribution_status_id:name ' , 'IN ' , $ allowedStatus )
22+ ->addWhere ('total_amount ' , '!= ' , 0 )
2223 ->execute ()
2324 ->first ();
2425
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ public static function setupBeforeClass(): void {
2828 self ::$ contribution = ContributionFabricator::fabricate ($ contributionParams );
2929 }
3030
31- public function setUp () {
31+ public function setUp (): void {
3232 }
3333
3434 public function testMakingPartialPaymentUpdatesContributionToPartiallyPaid (): void {
@@ -57,4 +57,21 @@ public function testMakingFullPaymentUpdatesContributionToCompleted(): void {
5757 $ this ->assertEquals ('Completed ' , $ contribution ['contribution_status ' ]);
5858 }
5959
60+ public function testZeroAmountContributionIsCreatedAsCompleted (): void {
61+ $ contact = ContactFabricator::fabricate ();
62+ self ::$ contribution = ContributionFabricator::fabricate ([
63+ 'financial_type_id ' => 'Donation ' ,
64+ 'receive_date ' => date ('Y-m-d ' ),
65+ 'total_amount ' => 0.00 ,
66+ 'contact_id ' => $ contact ['id ' ],
67+ 'payment_instrument_id ' => 'Credit Card ' ,
68+ 'trxn_id ' => md5 (time ()),
69+ 'currency ' => 'GBP ' ,
70+ ]);
71+
72+ $ contribution = civicrm_api3 ('Contribution ' , 'getSingle ' , ['id ' => self ::$ contribution ['id ' ]]);
73+
74+ $ this ->assertEquals ('Completed ' , $ contribution ['contribution_status ' ]);
75+ }
76+
6077}
You can’t perform that action at this time.
0 commit comments