From 82da1b6478f67df018e69e294e56492da4a49b84 Mon Sep 17 00:00:00 2001 From: ramittal Date: Thu, 18 Dec 2014 14:06:06 -0800 Subject: [PATCH 1/8] Removing phpunit_config dependency --- lib/net/authorize/util/HttpClient.php | 2 +- tests/AuthorizeNetARB_Test.php | 4 ++ tests/Controller_Test.php | 6 +- tests/bootstrap.php | 65 ++++++++++++++----- .../CreateTransactionControllerTest.php | 7 +- .../api/controller/LogoutControllerTest.php | 43 ++++++++++++ 6 files changed, 102 insertions(+), 25 deletions(-) create mode 100644 tests/net/authorize/api/controller/LogoutControllerTest.php diff --git a/lib/net/authorize/util/HttpClient.php b/lib/net/authorize/util/HttpClient.php index 6ef783ba..91be740d 100644 --- a/lib/net/authorize/util/HttpClient.php +++ b/lib/net/authorize/util/HttpClient.php @@ -23,7 +23,7 @@ class HttpClient */ public function __construct() { - $this->_log_file = AUTHORIZENET_LOG_FILE; + $this->_log_file = (defined('AUTHORIZENET_LOG_FILE') ? AUTHORIZENET_LOG_FILE : false); date_default_timezone_set('UTC'); } diff --git a/tests/AuthorizeNetARB_Test.php b/tests/AuthorizeNetARB_Test.php index 6f8a0c4b..26728c08 100644 --- a/tests/AuthorizeNetARB_Test.php +++ b/tests/AuthorizeNetARB_Test.php @@ -1,5 +1,9 @@ executeWithApiResponse(); + $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); // Handle the response. $this->assertNotNull($response, "null response"); diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 97795092..11e581b2 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,31 +3,60 @@ * Bootstraps the AuthorizeNet PHP SDK test suite */ -// Clear logfile -file_put_contents(AUTHORIZENET_LOG_FILE, ""); +define( "AUTHORIZENET_API_LOGIN_ID", $_ENV["api_login_id"]); //TODO +define( "AUTHORIZENET_TRANSACTION_KEY", $_ENV["transaction_key"]); //TODO +define( "AUTHORIZENET_LOG_FILE", "./authorize-net.log"); -if (!function_exists('simplexml_load_file')) { - throw new RuntimeException( - 'The AuthorizeNet SDK requires the SimpleXML PHP extension.' - ); +// Append to log file +date_default_timezone_set('UTC'); //necessary for the following date to set timezone +file_put_contents(AUTHORIZENET_LOG_FILE, sprintf("Logging Started: %s\n", date( DATE_RFC2822)), FILE_APPEND); + +// validate existence of available extensions +if (!function_exists('simplexml_load_file')) +{ + $errorMessage = 'The AuthorizeNet SDK requires the SimpleXML PHP extension.'; + throw new RuntimeException( $errorMessage ); +} + +if (!function_exists('curl_init')) +{ + $errorMessage = 'The AuthorizeNet SDK requires the cURL PHP extension.'; + throw new RuntimeException( $errorMessage ); +} + +// validate existence of properties +// properties file take precedence over environment +if (!defined('AUTHORIZENET_API_LOGIN_ID') || + !defined('AUTHORIZENET_TRANSACTION_KEY')) +{ + $errorMessage = "Undefined constants for merchant authentication"; + throw new RuntimeException( $errorMessage ); } -if (!function_exists('curl_init')) { - throw new RuntimeException( - 'The AuthorizeNet SDK requires the cURL PHP extension.' - ); +if (AUTHORIZENET_API_LOGIN_ID == "") +{ + AUTHORIZENET_API_LOGIN_ID == $_ENV["api_login_id"]; //TODO + if (AUTHORIZENET_API_LOGIN_ID == "") + { + $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'AUTHORIZENET_API_LOGIN_ID'"; + throw new RuntimeException( $errorMessage ); + } } -if (AUTHORIZENET_API_LOGIN_ID == "") { - throw new RuntimeException( - 'Copy /phpunit.xml.dist to /phpunit.xml and enter your merchant credentials' - . ' before running the tests.' - ); +if (AUTHORIZENET_TRANSACTION_KEY == "") +{ + AUTHORIZENET_TRANSACTION_KEY == $_ENV["transaction_key"]; //TODO + if (AUTHORIZENET_TRANSACTION_KEY == "") { + $errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'AUTHORIZENET_TRANSACTION_KEY'"; + throw new RuntimeException( $errorMessage ); + } } ini_set('error_reporting', E_ALL); -$loader = require 'vendor/autoload.php'; -if (!isset($loader)) { - throw new RuntimeException('vendor/autoload.php could not be found.'); +$loader = require '../vendor/autoload.php'; +if (!isset($loader)) +{ + $errorMessage = 'vendor/autoload.php could not be found.'; + throw new RuntimeException( $errorMessage ); } diff --git a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php index d12c7a85..99151067 100644 --- a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php +++ b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php @@ -14,10 +14,9 @@ use \net\authorize\api\controller\CreateTransactionController; -//use net\authorize\api\contract\v1\ - require_once __DIR__ . '/../../../../../autoload.php'; -require_once __DIR__ . '/../../../../../phpunit_config.php'; +//include if tests/bootstrap.php is not loaded automatically +//require_once __DIR__ . '/../../../../bootstrap.php'; class CreateTransactionControllerTest extends \PHPUnit_Framework_TestCase { @@ -104,7 +103,7 @@ public function testCreateTransactionCreditCard() $request->setTransactionRequest( $transactionRequestType); $controller = new CreateTransactionController($request); - $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::CUSTOM); + $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); $response = $controller->getApiResponse(); // Handle the response. diff --git a/tests/net/authorize/api/controller/LogoutControllerTest.php b/tests/net/authorize/api/controller/LogoutControllerTest.php new file mode 100644 index 00000000..5fc20e48 --- /dev/null +++ b/tests/net/authorize/api/controller/LogoutControllerTest.php @@ -0,0 +1,43 @@ +setName($name); + $merchantAuthentication->setTransactionKey($transactionKey); + + $refId = 'ref' . time(); + + $request = new LogoutRequest(); + $request->setMerchantAuthentication($merchantAuthentication); + $request->setRefId( $refId); + + $controller = new LogoutController($request); + $response = $controller->executeWithApiResponse( \net\authorize\api\constants\ANetEnvironment::SANDBOX); + // Handle the response. + $this->assertNotNull($response, "null response"); + $this->assertNotNull($response->getMessages()); + + $this->assertEquals("Ok", $response->getMessages()->getResultCode()); + $this->assertEquals($response->getRefId(), $refId); + $this->assertTrue(0 < count($response->getMessages())); + foreach ($response->getMessages() as $message) + { + $this->assertEquals("I00001", $message->getCode()); + $this->assertEquals("Successful.", $response->getText()); + } + } +} \ No newline at end of file From 7334cf983b5bc1be7eeaf0274291ed2fe51dd5e3 Mon Sep 17 00:00:00 2001 From: ramittal Date: Thu, 18 Dec 2014 14:33:38 -0800 Subject: [PATCH 2/8] adding jms serializer to runtime from dev --- composer.json | 6 +++--- tests/AuthorizeNetARB_Test.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 674c1b73..8ef0af3a 100644 --- a/composer.json +++ b/composer.json @@ -10,14 +10,14 @@ "ext-curl": "*", "ext-json": "*", "ext-simplexml": "*", - "ext-xmlwriter": "*" + "ext-xmlwriter": "*", + "jms/serializer": "*" }, "require-dev": { "phpunit/phpunit": "~4.0", "phpmd/phpmd": "~2.0", "goetas/xsd2php":"2.*@dev", - "goetas/xsd-reader":"2.*@dev", - "jms/serializer": "xsd2php-dev as 0.18.0" + "goetas/xsd-reader":"2.*@dev" }, "suggest": { "phpdocumentor/phpdocumentor": "For generating API documentation" diff --git a/tests/AuthorizeNetARB_Test.php b/tests/AuthorizeNetARB_Test.php index 26728c08..53b41783 100644 --- a/tests/AuthorizeNetARB_Test.php +++ b/tests/AuthorizeNetARB_Test.php @@ -2,7 +2,7 @@ require_once "../autoload.php"; //include if tests/bootstrap.php is not loaded automatically -require_once __DIR__ . '/bootstrap.php'; +//require_once __DIR__ . '/bootstrap.php'; class AuthorizeNetARB_Test extends PHPUnit_Framework_TestCase { From a250b26147c178f514eaea02a5ec7e3c4b5debc5 Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 15:14:47 -0800 Subject: [PATCH 3/8] Fixing the environment variables lookup --- tests/AuthorizeNetARB_Test.php | 3 +-- tests/bootstrap.php | 36 +++++++++++++++++++++------------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/tests/AuthorizeNetARB_Test.php b/tests/AuthorizeNetARB_Test.php index 53b41783..df875bca 100644 --- a/tests/AuthorizeNetARB_Test.php +++ b/tests/AuthorizeNetARB_Test.php @@ -1,6 +1,5 @@ assertEquals($response->getRefId(), $refId); $this->assertEquals($response->getResultCode(), "Ok"); } -} \ No newline at end of file +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 11e581b2..c35e3593 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,9 +3,18 @@ * Bootstraps the AuthorizeNet PHP SDK test suite */ -define( "AUTHORIZENET_API_LOGIN_ID", $_ENV["api_login_id"]); //TODO -define( "AUTHORIZENET_TRANSACTION_KEY", $_ENV["transaction_key"]); //TODO -define( "AUTHORIZENET_LOG_FILE", "./authorize-net.log"); +if (!defined('AUTHORIZENET_API_LOGIN_ID')) +{ + define( "AUTHORIZENET_API_LOGIN_ID", ( ( null == getenv("api_login_id")) ? getenv("api_login_id") : "")); +} +if (!defined('AUTHORIZENET_LOG_FILE')) +{ + define( "AUTHORIZENET_TRANSACTION_KEY", ( ( null == getenv("transaction_key")) ? getenv("transaction_key") : "")); +} +if (!defined('AUTHORIZENET_LOG_FILE')) +{ + define( "AUTHORIZENET_LOG_FILE", "./authorize-net.log"); +} // Append to log file date_default_timezone_set('UTC'); //necessary for the following date to set timezone @@ -33,23 +42,22 @@ throw new RuntimeException( $errorMessage ); } +if (null == AUTHORIZENET_API_LOGIN_ID || null == AUTHORIZENET_LOG_FILE) +{ + $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' or 'AUTHORIZENET_TRANSACTION_KEY' not found."; + throw new RuntimeException( $errorMessage ); +} + if (AUTHORIZENET_API_LOGIN_ID == "") { - AUTHORIZENET_API_LOGIN_ID == $_ENV["api_login_id"]; //TODO - if (AUTHORIZENET_API_LOGIN_ID == "") - { - $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'AUTHORIZENET_API_LOGIN_ID'"; - throw new RuntimeException( $errorMessage ); - } + $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'AUTHORIZENET_API_LOGIN_ID'"; + throw new RuntimeException( $errorMessage ); } if (AUTHORIZENET_TRANSACTION_KEY == "") { - AUTHORIZENET_TRANSACTION_KEY == $_ENV["transaction_key"]; //TODO - if (AUTHORIZENET_TRANSACTION_KEY == "") { - $errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'AUTHORIZENET_TRANSACTION_KEY'"; - throw new RuntimeException( $errorMessage ); - } + $errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'AUTHORIZENET_TRANSACTION_KEY'"; + throw new RuntimeException( $errorMessage ); } ini_set('error_reporting', E_ALL); From 439aafa8803a293d551fd10be24b1bf33e083997 Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 17:06:40 -0800 Subject: [PATCH 4/8] Fixing the lookup of credential from env. --- lib/net/authorize/util/HttpClient.php | 7 +--- tests/Controller_Test.php | 6 +-- tests/bootstrap.php | 38 ++++++------------- .../CreateTransactionControllerTest.php | 6 +-- .../api/controller/LogoutControllerTest.php | 6 +-- 5 files changed, 22 insertions(+), 41 deletions(-) diff --git a/lib/net/authorize/util/HttpClient.php b/lib/net/authorize/util/HttpClient.php index 91be740d..247d6a7c 100644 --- a/lib/net/authorize/util/HttpClient.php +++ b/lib/net/authorize/util/HttpClient.php @@ -1,8 +1,6 @@ _log_file, sprintf("\n%s:Request to AnetApi: \n%s", $this->now(), $xmlRequest), FILE_APPEND); if ($this->VERIFY_PEER) { - curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '../../../ssl/cert.pem');//..\..\..\ssl\cert.pem + curl_setopt($curl_request, CURLOPT_CAINFO, dirname(dirname(__FILE__)) . '/../../ssl/cert.pem'); } else { if ($this->_log_file) { file_put_contents($this->_log_file, "\nInvalid SSL option for the request", FILE_APPEND); @@ -118,4 +115,4 @@ private function now() { return date( DATE_RFC2822); } -} \ No newline at end of file +} diff --git a/tests/Controller_Test.php b/tests/Controller_Test.php index 5e985594..37988276 100644 --- a/tests/Controller_Test.php +++ b/tests/Controller_Test.php @@ -10,8 +10,8 @@ class Controller_Test extends PHPUnit_Framework_TestCase { public function testARBGetSubscriptionList() { - $name = AUTHORIZENET_API_LOGIN_ID; - $transactionKey = AUTHORIZENET_TRANSACTION_KEY; + $name = $global_api_login_id; + $transactionKey = $global_transaction_key; $merchantAuthentication = new net\authorize\api\contract\v1\MerchantAuthenticationType(); $merchantAuthentication->setName($name); @@ -66,4 +66,4 @@ protected function validateRequest() { //empty } -} \ No newline at end of file +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php index c35e3593..28ecc84c 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -3,14 +3,10 @@ * Bootstraps the AuthorizeNet PHP SDK test suite */ -if (!defined('AUTHORIZENET_API_LOGIN_ID')) -{ - define( "AUTHORIZENET_API_LOGIN_ID", ( ( null == getenv("api_login_id")) ? getenv("api_login_id") : "")); -} -if (!defined('AUTHORIZENET_LOG_FILE')) -{ - define( "AUTHORIZENET_TRANSACTION_KEY", ( ( null == getenv("transaction_key")) ? getenv("transaction_key") : "")); -} +//properties set in file take precedence over environment +//default the value to use +$global_api_login_id = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id"); +$global_transaction_key = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key"); if (!defined('AUTHORIZENET_LOG_FILE')) { define( "AUTHORIZENET_LOG_FILE", "./authorize-net.log"); @@ -33,34 +29,21 @@ throw new RuntimeException( $errorMessage ); } -// validate existence of properties -// properties file take precedence over environment -if (!defined('AUTHORIZENET_API_LOGIN_ID') || - !defined('AUTHORIZENET_TRANSACTION_KEY')) -{ - $errorMessage = "Undefined constants for merchant authentication"; - throw new RuntimeException( $errorMessage ); -} - -if (null == AUTHORIZENET_API_LOGIN_ID || null == AUTHORIZENET_LOG_FILE) -{ - $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' or 'AUTHORIZENET_TRANSACTION_KEY' not found."; - throw new RuntimeException( $errorMessage ); -} - -if (AUTHORIZENET_API_LOGIN_ID == "") +// validate existence of credentials +if (null == $global_api_login_id || "" == $global_api_login_id) { - $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'AUTHORIZENET_API_LOGIN_ID'"; + $errorMessage = "Property 'AUTHORIZENET_API_LOGIN_ID' not found. Define the property value or set the environment 'api_login_id'"; throw new RuntimeException( $errorMessage ); } -if (AUTHORIZENET_TRANSACTION_KEY == "") +if (null == $global_transaction_key || "" == $global_transaction_key) { - $errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'AUTHORIZENET_TRANSACTION_KEY'"; + $errorMessage = "Property 'AUTHORIZENET_TRANSACTION_KEY' not found. Define the property value or set the environment 'transaction_key'"; throw new RuntimeException( $errorMessage ); } ini_set('error_reporting', E_ALL); +/* $loader = require '../vendor/autoload.php'; if (!isset($loader)) @@ -68,3 +51,4 @@ $errorMessage = 'vendor/autoload.php could not be found.'; throw new RuntimeException( $errorMessage ); } +*/ diff --git a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php index 99151067..00c49e7c 100644 --- a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php +++ b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php @@ -80,8 +80,8 @@ public function __construct() public function testCreateTransactionCreditCard() { - $name = AUTHORIZENET_API_LOGIN_ID; - $transactionKey = AUTHORIZENET_TRANSACTION_KEY; + $name = $global_api_login_id; + $transactionKey = $tglobal_ransaction_key; $merchantAuthentication = new MerchantAuthenticationType(); $merchantAuthentication->setName($name); $merchantAuthentication->setTransactionKey($transactionKey); @@ -131,4 +131,4 @@ private function setValidAmount( $number) } const MaxTransactionAmount = 10000; //214747; -} \ No newline at end of file +} diff --git a/tests/net/authorize/api/controller/LogoutControllerTest.php b/tests/net/authorize/api/controller/LogoutControllerTest.php index 5fc20e48..24460ad8 100644 --- a/tests/net/authorize/api/controller/LogoutControllerTest.php +++ b/tests/net/authorize/api/controller/LogoutControllerTest.php @@ -13,8 +13,8 @@ class LogoutControllerTest extends \PHPUnit_Framework_TestCase { public function testLogout() { - $name = AUTHORIZENET_API_LOGIN_ID; - $transactionKey = AUTHORIZENET_TRANSACTION_KEY; + $name = $global_api_login_id; + $transactionKey = $global_transaction_key; $merchantAuthentication = new MerchantAuthenticationType(); $merchantAuthentication->setName($name); $merchantAuthentication->setTransactionKey($transactionKey); @@ -40,4 +40,4 @@ public function testLogout() $this->assertEquals("Successful.", $response->getText()); } } -} \ No newline at end of file +} From e55a138ec7af02a87ccefa1e03ca2df4360b14fd Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 17:23:06 -0800 Subject: [PATCH 5/8] fixing bootstrap --- tests/bootstrap.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 28ecc84c..3c5d031e 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -43,7 +43,6 @@ } ini_set('error_reporting', E_ALL); -/* $loader = require '../vendor/autoload.php'; if (!isset($loader)) @@ -51,4 +50,3 @@ $errorMessage = 'vendor/autoload.php could not be found.'; throw new RuntimeException( $errorMessage ); } -*/ From 3f271a42509e026bc172583e89ecc84404a434ed Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 17:28:22 -0800 Subject: [PATCH 6/8] Fixing the bootstrap again. --- tests/bootstrap.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 3c5d031e..2d2ee688 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -44,9 +44,11 @@ ini_set('error_reporting', E_ALL); +/* $loader = require '../vendor/autoload.php'; if (!isset($loader)) { $errorMessage = 'vendor/autoload.php could not be found.'; throw new RuntimeException( $errorMessage ); } +*/ From 4efa93564902744a01284aaeae52e88532ed19b0 Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 17:38:57 -0800 Subject: [PATCH 7/8] Fixing credentials --- tests/Controller_Test.php | 4 ++-- .../api/controller/CreateTransactionControllerTest.php | 4 ++-- tests/net/authorize/api/controller/LogoutControllerTest.php | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/Controller_Test.php b/tests/Controller_Test.php index 37988276..de47d3a4 100644 --- a/tests/Controller_Test.php +++ b/tests/Controller_Test.php @@ -10,8 +10,8 @@ class Controller_Test extends PHPUnit_Framework_TestCase { public function testARBGetSubscriptionList() { - $name = $global_api_login_id; - $transactionKey = $global_transaction_key; + $name = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id"); + $transactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key"); $merchantAuthentication = new net\authorize\api\contract\v1\MerchantAuthenticationType(); $merchantAuthentication->setName($name); diff --git a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php index 00c49e7c..9b592350 100644 --- a/tests/net/authorize/api/controller/CreateTransactionControllerTest.php +++ b/tests/net/authorize/api/controller/CreateTransactionControllerTest.php @@ -80,8 +80,8 @@ public function __construct() public function testCreateTransactionCreditCard() { - $name = $global_api_login_id; - $transactionKey = $tglobal_ransaction_key; + $name = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id"); + $transactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key"); $merchantAuthentication = new MerchantAuthenticationType(); $merchantAuthentication->setName($name); $merchantAuthentication->setTransactionKey($transactionKey); diff --git a/tests/net/authorize/api/controller/LogoutControllerTest.php b/tests/net/authorize/api/controller/LogoutControllerTest.php index 24460ad8..4fa26519 100644 --- a/tests/net/authorize/api/controller/LogoutControllerTest.php +++ b/tests/net/authorize/api/controller/LogoutControllerTest.php @@ -13,8 +13,8 @@ class LogoutControllerTest extends \PHPUnit_Framework_TestCase { public function testLogout() { - $name = $global_api_login_id; - $transactionKey = $global_transaction_key; + $name = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id"); + $transactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key"); $merchantAuthentication = new MerchantAuthenticationType(); $merchantAuthentication->setName($name); $merchantAuthentication->setTransactionKey($transactionKey); From eb5c219046cc655cfc5366598e8a2e8ccbb92166 Mon Sep 17 00:00:00 2001 From: Rajeev Mittal Date: Thu, 18 Dec 2014 17:50:05 -0800 Subject: [PATCH 8/8] Fixing test imports --- tests/Controller_Test.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Controller_Test.php b/tests/Controller_Test.php index de47d3a4..ee417438 100644 --- a/tests/Controller_Test.php +++ b/tests/Controller_Test.php @@ -3,8 +3,7 @@ require_once __DIR__ . '/../autoload.php'; //include if tests/bootstrap.php is not loaded automatically -require_once __DIR__ . '/bootstrap.php'; - +//require_once __DIR__ . '/bootstrap.php'; class Controller_Test extends PHPUnit_Framework_TestCase {