From 06f2fdb69e13b9ab26b676e7235caff62514fa9c Mon Sep 17 00:00:00 2001 From: Camilo Rodriguez Date: Tue, 17 Apr 2018 16:27:06 +0000 Subject: [PATCH] CRM-38: Fix Failing Tests --- CRM/Core/Payment/PayPalImpl.php | 5 ++--- Civi/Test/Api3TestTrait.php | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CRM/Core/Payment/PayPalImpl.php b/CRM/Core/Payment/PayPalImpl.php index 80b01dba5788..5a1e7c304208 100644 --- a/CRM/Core/Payment/PayPalImpl.php +++ b/CRM/Core/Payment/PayPalImpl.php @@ -1039,9 +1039,8 @@ public function invokeAPI($args, $url = NULL) { curl_close($ch); } - if (strtolower($result['ack']) != 'success' && - strtolower($result['ack']) != 'successwithwarning' - ) { + $ack = strtolower(CRM_Utils_Array::value('ack', $result)); + if ($ack != 'success' && $ack != 'successwithwarning') { throw new PaymentProcessorException("{$result['l_shortmessage0']} {$result['l_longmessage0']}"); $e = CRM_Core_Error::singleton(); $e->push($result['l_errorcode0'], diff --git a/Civi/Test/Api3TestTrait.php b/Civi/Test/Api3TestTrait.php index 767c7233907f..1efcd13ce693 100644 --- a/Civi/Test/Api3TestTrait.php +++ b/Civi/Test/Api3TestTrait.php @@ -160,7 +160,7 @@ public function callAPISuccess($entity, $action, $params, $checkAgainst = NULL) * @param string $entity * @param array $params * @param null $count - * @throws Exception + * @throws \Exception * @return array|int */ public function callAPISuccessGetCount($entity, $params, $count = NULL) { @@ -170,7 +170,7 @@ public function callAPISuccessGetCount($entity, $params, $count = NULL) { ); $result = $this->civicrm_api($entity, 'getcount', $params); if (!is_int($result) || !empty($result['is_error']) || isset($result['values'])) { - throw new Exception('Invalid getcount result : ' . print_r($result, TRUE) . " type :" . gettype($result)); + throw new \Exception('Invalid getcount result : ' . print_r($result, TRUE) . " type :" . gettype($result)); } if (is_int($count)) { $this->assertEquals($count, $result, "incorrect count returned from $entity getcount"); @@ -193,7 +193,7 @@ public function callAPISuccessGetCount($entity, $params, $count = NULL) { * - array * - object * - * @throws Exception + * @throws \Exception * @return array|int */ public function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL) { @@ -202,7 +202,7 @@ public function callAPISuccessGetSingle($entity, $params, $checkAgainst = NULL) ); $result = $this->civicrm_api($entity, 'getsingle', $params); if (!is_array($result) || !empty($result['is_error']) || isset($result['values'])) { - throw new Exception('Invalid getsingle result' . print_r($result, TRUE)); + throw new \Exception('Invalid getsingle result' . print_r($result, TRUE)); } if ($checkAgainst) { // @todo - have gone with the fn that unsets id? should we check id?