From e60334eb6b64a726defb0e617775b4c6e2ec2ded Mon Sep 17 00:00:00 2001 From: Remco Tolsma Date: Fri, 27 Jun 2014 14:54:02 +0200 Subject: [PATCH] Also added an test for non existing response code. --- src/ResponseCodes.php | 4 ++++ tests/ResponseCodesTest.php | 1 + 2 files changed, 5 insertions(+) diff --git a/src/ResponseCodes.php b/src/ResponseCodes.php index e3e648c..bba00cf 100644 --- a/src/ResponseCodes.php +++ b/src/ResponseCodes.php @@ -152,6 +152,8 @@ class Pronamic_WP_Pay_OmniKassa_ResponseCodes { * @param string $response_code */ public static function transform( $response_code ) { + $status = null; + switch ( $response_code ) { case self::TRANSACTION_SUCCES: return Pronamic_WP_Pay_Statuses::SUCCESS; @@ -165,5 +167,7 @@ public static function transform( $response_code ) { case self::REQUEST_TIMEOUT: return Pronamic_WP_Pay_Statuses::EXPIRED; } + + return $status; } } diff --git a/tests/ResponseCodesTest.php b/tests/ResponseCodesTest.php index 6081f88..436f9aa 100644 --- a/tests/ResponseCodesTest.php +++ b/tests/ResponseCodesTest.php @@ -27,6 +27,7 @@ public function statusMatrixProvider() { array( Pronamic_WP_Pay_OmniKassa_ResponseCodes::CANCELLATION_OF_PAYMENT, Pronamic_WP_Pay_Statuses::CANCELLED ), array( Pronamic_WP_Pay_OmniKassa_ResponseCodes::PENDING_TRANSACTION, Pronamic_WP_Pay_Statuses::OPEN ), array( Pronamic_WP_Pay_OmniKassa_ResponseCodes::REQUEST_TIMEOUT, Pronamic_WP_Pay_Statuses::EXPIRED ), + array( 'not existing response code', null ), ); } }