11<?php
2- $ errorlevel =error_reporting ();
3- error_reporting ($ errorlevel & ~E_NOTICE ); //turn off constant re-defined and other notices
4-
52define ("DONT_RUN_SAMPLES " , "true " );
63define ("SAMPLE_CODE_NAME_HEADING " , "SampleCodeName " );
74require '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/ ' ,
1420 'ApplePayTransactions/ ' ,
1521 'VisaCheckout/ '
1622);
23+
24+ $ errorlevel =error_reporting ();
25+ error_reporting ($ errorlevel & ~E_NOTICE ); //turn off constant re-defined and other notices
1726foreach ($ 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+
2333error_reporting ($ errorlevel );
2434class 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