Skip to content

Commit 4856359

Browse files
committed
Added directory prefix, so that test-runnner from sdk as well.
1 parent 73f1bf1 commit 4856359

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

test-runner.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
define("DONT_RUN_SAMPLES", "true");
66
define("SAMPLE_CODE_NAME_HEADING", "SampleCodeName");
77
require 'vendor/autoload.php';
8+
9+
if ( $_SERVER['argc'] != 3 ) {
10+
die('\n Usage: phpunit test-runner.php <SampleCodeDirectoryPath>');
11+
}
12+
$dirPath = $_SERVER['argv'][2];
13+
if(substr($dirPath, -1) != "/")
14+
$dirPath = $dirPath."/";
15+
16+
$prefix = getDirectoryPrefix();
817
$directories = array(
918
'CustomerProfiles/',
1019
'RecurringBilling/',
@@ -14,12 +23,13 @@
1423
'ApplePayTransactions/',
1524
'VisaCheckout/'
1625
);
17-
foreach ($directories as $directory) {
26+
foreach ($directories as $dirPath.$directory) {
1827
foreach(glob($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
{
@@ -45,10 +55,7 @@ public static function getDay(){
4555
public function testAllSampleCodes(){
4656
$runTests = 0;
4757

48-
if ( $_SERVER['argc'] != 3 ) {
49-
die('\n Usage: phpunit test-runner.php <SampleCodeListFile>');
50-
}
51-
$file = $_SERVER['argv'][2];
58+
$file = $dirPath."SampleCodeList.txt";
5259
$data = file($file) or die('\nCould not read SampleCodeList.');
5360
foreach ($data as $line)
5461
{

0 commit comments

Comments
 (0)