From 98841922f64c8e0dfea66f87a94507328e11e75e Mon Sep 17 00:00:00 2001 From: Jaap Jansma Date: Mon, 21 Jun 2021 10:15:36 +0200 Subject: [PATCH] dev/financial#6 Added is template to search screen --- .../CRM/Contribute/Form/SearchTest.php | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/phpunit/CRM/Contribute/Form/SearchTest.php b/tests/phpunit/CRM/Contribute/Form/SearchTest.php index efcf948ef2..3bc88cf238 100644 --- a/tests/phpunit/CRM/Contribute/Form/SearchTest.php +++ b/tests/phpunit/CRM/Contribute/Form/SearchTest.php @@ -511,6 +511,28 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase { 'contribution_status_id' => 5, 'financial_type_id' => "Donation", ]); + // Create a template contribution. + $TemplateContribution = $this->callAPISuccess('Contribution', 'create', [ + 'financial_type_id' => 'Donation', + 'total_amount' => 11, + 'receive_date' => date('Ymd'), + 'receive_date_time' => NULL, + 'payment_instrument_id' => 1, + 'contribution_status_id' => 1, + 'contact_id' => $this->ids['Contact']['contactID1'], + 'contribution_recur_id' => $ContributionRecur1['id'], + 'is_template' => 1 + ]); + $params = [ + 'to_financial_account_id' => 1, + 'status_id' => 1, + 'contribution_id' => $TemplateContribution['id'], + 'payment_instrument_id' => 1, + 'card_type_id' => 1, + 'total_amount' => 11, + ]; + CRM_Core_BAO_FinancialTrxn::create($params); + // Create a normal contribution $Contribution1 = $this->callAPISuccess('Contribution', 'create', [ 'financial_type_id' => 'Donation', 'total_amount' => 11, @@ -592,6 +614,13 @@ class CRM_Contribute_Form_SearchTest extends CiviUnitTestCase { 'expected_contact' => [], 'expected_qill' => "Recurring Contribution Status = 'Cancelled'", ], + // Case 4: Search for contributions with is_template = 1 + 'in_progress_search' => [ + 'form_value' => ['contribution_is_template' => 1], + 'expected_count' => 1, + 'expected_contact' => ['Mr. Joe Miller II'], + 'expected_qill' => "Is a Template Contribution = \"1\"", + ], 'trxn_id_search' => [ 'form_value' => ['contribution_recur_trxn_id' => 'a transaction'], 'expected_count' => 1, -- 2.25.1