Test regression fix
authorEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 27 Sep 2021 21:21:40 +0000 (10:21 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Mon, 27 Sep 2021 21:21:40 +0000 (10:21 +1300)
CRM/Contribute/Form/Contribution.php
tests/phpunit/CRM/Contribute/Form/ContributionTest.php

index 9526d6bb7d4a68f498f9a656a21f7af7a8362386..ba9b781b33c58141979daaa0c85b896338bd3db6 100644 (file)
@@ -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())
index 9bf1e03523d6b1427a9e3e654485419369fd8479..e7788fb61f0f4674be34076bb09961f91e98a36e 100644 (file)
@@ -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 {