From 4ecbf1277d285762c10be545a2dcf8950afa1895 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Tue, 21 Jul 2015 21:22:05 +1200 Subject: [PATCH] test follow up fixes on payment processor instantiation --- Civi/Payment/System.php | 5 +++-- tests/phpunit/CiviTest/CiviUnitTestCase.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Civi/Payment/System.php b/Civi/Payment/System.php index 7a19fb1092..253784f2d7 100644 --- a/Civi/Payment/System.php +++ b/Civi/Payment/System.php @@ -60,14 +60,15 @@ class System { } $processorObject = new $paymentClass(!empty($processor['is_test']) ? 'test' : 'live', $processor); - if (!$force && !$processorObject->checkConfig()) { + if (!$force && $processorObject->checkConfig()) { $processorObject = NULL; } else { $processorObject->setPaymentProcessor($processor); } + $this->cache[$id] = $processorObject; } - $this->cache[$id] = $processorObject; + return $this->cache[$id]; } diff --git a/tests/phpunit/CiviTest/CiviUnitTestCase.php b/tests/phpunit/CiviTest/CiviUnitTestCase.php index a8a830ad48..bc63fe90c6 100755 --- a/tests/phpunit/CiviTest/CiviUnitTestCase.php +++ b/tests/phpunit/CiviTest/CiviUnitTestCase.php @@ -1455,7 +1455,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase { 'billing_mode' => 1, ), $params); - $result = $this->callAPISuccess('payment_processor', 'create', $params); + $result = $this->callAPISuccess('PaymentProcessor', 'create', $params); return $result['id']; } -- 2.25.1