test follow up fixes on payment processor instantiation
authorEileen McNaughton <eileen@fuzion.co.nz>
Tue, 21 Jul 2015 09:22:05 +0000 (21:22 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Tue, 21 Jul 2015 09:22:05 +0000 (21:22 +1200)
Civi/Payment/System.php
tests/phpunit/CiviTest/CiviUnitTestCase.php

index 7a19fb1092e871683b9d7e1eadfb531dd408f04c..253784f2d7199988d6f907a23c0694eeda633450 100644 (file)
@@ -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];
   }
 
index a8a830ad486120df7346221114b8f14682fdd17c..bc63fe90c6b9b5ae2dded0f7818ba6001065d424 100755 (executable)
@@ -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'];
   }