From: Eileen McNaughton Date: Mon, 27 Sep 2021 21:21:40 +0000 (+1300) Subject: Test regression fix X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=21adcaecda6c767d063b82b1c6537b9f1be87200;p=civicrm-core.git Test regression fix --- 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 {