From 21adcaecda6c767d063b82b1c6537b9f1be87200 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 28 Sep 2021 10:21:40 +1300 Subject: [PATCH] Test regression fix --- CRM/Contribute/Form/Contribution.php | 7 +++++-- tests/phpunit/CRM/Contribute/Form/ContributionTest.php | 3 --- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CRM/Contribute/Form/Contribution.php b/CRM/Contribute/Form/Contribution.php index 9526d6bb7d..ba9b781b33 100644 --- a/CRM/Contribute/Form/Contribution.php +++ b/CRM/Contribute/Form/Contribution.php @@ -1840,11 +1840,14 @@ class CRM_Contribute_Form_Contribution extends CRM_Contribute_Form_AbstractEditP /** * Get the selected contribution status. * - * @return string + * @return string|null * * @throws \API_Exception */ - protected function getPreviousContributionStatus(): string { + protected function getPreviousContributionStatus(): ?string { + if (!$this->getContributionID()) { + return NULL; + } if (!$this->previousContributionStatus) { $this->previousContributionStatus = Contribution::get(FALSE) ->addWhere('id', '=', $this->getContributionID()) diff --git a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php index 9bf1e03523..e7788fb61f 100644 --- a/tests/phpunit/CRM/Contribute/Form/ContributionTest.php +++ b/tests/phpunit/CRM/Contribute/Form/ContributionTest.php @@ -144,9 +144,6 @@ class CRM_Contribute_Form_ContributionTest extends CiviUnitTestCase { * * @param string $thousandSeparator * - * @throws \CRM_Core_Exception - * @throws \CiviCRM_API3_Exception - * @throws \Civi\Payment\Exception\PaymentProcessorException * @dataProvider getThousandSeparators */ public function testSubmit(string $thousandSeparator): void { -- 2.25.1