Skip to content

Commit 63bcfe5

Browse files
committed
Merge pull request AuthorizeNet#33 from ashtru/master
Changes for including sample code in sdk, and PHP7
2 parents 549846e + 62d180c commit 63bcfe5

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ language: php
22

33
php:
44
- 5.6
5+
- 7.0
56

67
sudo: false
78

89
before_script:
9-
- composer install --prefer-dist --dev
10+
- composer install --prefer-dist --ignore-platform-reqs
1011

1112
script:
12-
- phpunit test-runner.php
13+
- phpunit test-runner.php .

test-runner.php

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
<?php
2-
$errorlevel=error_reporting();
3-
error_reporting($errorlevel & ~E_NOTICE); //turn off constant re-defined and other notices
4-
52
define("DONT_RUN_SAMPLES", "true");
63
define("SAMPLE_CODE_NAME_HEADING", "SampleCodeName");
74
require 'vendor/autoload.php';
5+
6+
if ( $_SERVER['argc'] != 3 ) {
7+
die('\n Usage: phpunit test-runner.php <SampleCodeDirectoryPath>');
8+
}
9+
$dirPath = $_SERVER['argv'][2];
10+
echo $dirPath;
11+
if(substr($dirPath, -1) != "/")
12+
$dirPath = $dirPath."/";
13+
814
$directories = array(
915
'CustomerProfiles/',
1016
'RecurringBilling/',
@@ -14,12 +20,16 @@
1420
'ApplePayTransactions/',
1521
'VisaCheckout/'
1622
);
23+
24+
$errorlevel=error_reporting();
25+
error_reporting($errorlevel & ~E_NOTICE); //turn off constant re-defined and other notices
1726
foreach ($directories as $directory) {
18-
foreach(glob($directory . "*.php") as $sample) {
27+
foreach(glob($dirPath.$directory . "*.php") as $sample) {
1928
require_once $sample;
2029
//echo $sample;
2130
}
2231
}
32+
2333
error_reporting($errorlevel);
2434
class TestRunner extends PHPUnit_Framework_TestCase
2535
{
@@ -44,7 +54,8 @@ public static function getDay(){
4454
}
4555
public function testAllSampleCodes(){
4656
$runTests = 0;
47-
$file = 'SampleCodeList.txt';
57+
58+
$file = $GLOBALS["dirPath"]."SampleCodeList.txt";
4859
$data = file($file) or die('\nCould not read SampleCodeList.');
4960
foreach ($data as $line)
5061
{
@@ -372,4 +383,4 @@ public static function runGetHostedProfilePage()
372383

373384
return $profileResponse;
374385
}
375-
}
386+
}

0 commit comments

Comments
 (0)