From fd78ef128497b13cc5314da045f6a6ed6a295ad3 Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Sat, 5 Nov 2022 22:07:12 +0000 Subject: [PATCH] Prepare testing page --- php/LDB-Tests/example_output.php | 56 ++++++++++++++++++++++++++ php/LDB-Tests/example_output_SV.php | 61 +++++++++++++++++++++++++++++ 2 files changed, 117 insertions(+) create mode 100644 php/LDB-Tests/example_output.php create mode 100644 php/LDB-Tests/example_output_SV.php diff --git a/php/LDB-Tests/example_output.php b/php/LDB-Tests/example_output.php new file mode 100644 index 0000000..19806e3 --- /dev/null +++ b/php/LDB-Tests/example_output.php @@ -0,0 +1,56 @@ + + + + TESTING + + + GetDepartureBoard(10,"GTW"); + $template["header"] = " + + + + + + + + + + + "; + $template["row"] = " + + + + + + + "; + $template["footer"] = " + +
TimeDestinationPlatformExpected
{std}{destination}{platform}{etd}
+ "; + if (isset($response->GetStationBoardResult->trainServices->service)) + { + print $template["header"]; + foreach($response->GetStationBoardResult->trainServices->service as $service) + { + $row = $template["row"]; + $destinations = array(); + foreach($service->destination->location as $location) + { + $destinations[] = $location->locationName; + } + $row = str_replace("{std}",$service->std,$row); + $row = str_replace("{destination}",implode(" and ",$destinations),$row); + $row = str_replace("{platform}",(isset($service->platform)?$service->platform:" "),$row); + $row = str_replace("{etd}",$service->etd,$row); + print $row; + } + print $template["footer"]; + } + ?> + + \ No newline at end of file diff --git a/php/LDB-Tests/example_output_SV.php b/php/LDB-Tests/example_output_SV.php new file mode 100644 index 0000000..05bbe88 --- /dev/null +++ b/php/LDB-Tests/example_output_SV.php @@ -0,0 +1,61 @@ + + + + TESTING + + + GetDepartureBoardByCRS(10,"BRI",date("H:i:s",time()),120,"","","","","True"); + $template["header"] = " + + + + + + + + + + + + + "; + $template["row"] = " + + + + + + + + + "; + $template["footer"] = " + +
IDOrg.Dest.Plat.SchExp
{id}{org}{dest}{plat}{sch}{act}
+ "; + if (isset($response->GetBoardResult->trainServices->service)) + { + print $template["header"]; + foreach($response->GetBoardResult->trainServices->service as $service) + { + $row = $template["row"]; + $destinations = array(); + + $row = str_replace("{id}",$service->trainid,$row); + $row = str_replace("{org}",$service->origin->location->tiploc,$row); + $row = str_replace("{dest}",$service->destination->location->tiploc,$row); + $row = str_replace("{plat}",$service->platform,$row); + $row = str_replace("{sch}",$servoce->std,$row); + $row = str_replace("{act}",$service->etd,$row); + print $row; + } + print $template["footer"]; + } + ?> + + \ No newline at end of file