diff --git a/tests/api/InternalApiTest.php b/tests/api/InternalApiTest.php index 42ad9fa3844..c6d9b6b3385 100644 --- a/tests/api/InternalApiTest.php +++ b/tests/api/InternalApiTest.php @@ -94,7 +94,9 @@ function testFetchApi() { $gbl::setNotRestCall(); $restRequest = new HttpRestRequest($gbl, $_SERVER); $restRequest->setRequestMethod("GET"); -$restRequest->setRequestURI("/api/facility"); +$restRequest->setRequestPath("/api/facility"); +$restRequest->setIsLocalApi(true); +$restRequest->setApiType("oemr"); // below will return as json echo "api via route handler call returning json:
"; echo HttpRestRouteHandler::dispatch($gbl::$ROUTE_MAP, $restRequest, 'direct-json'); diff --git a/tests/api/InternalFhirTest.php b/tests/api/InternalFhirTest.php index 734d08ea0f1..af9644a7ee8 100644 --- a/tests/api/InternalFhirTest.php +++ b/tests/api/InternalFhirTest.php @@ -30,7 +30,7 @@ function testAjaxApi() { $.ajax({ type: 'GET', - url: '../../apis/api/facility', + url: '../../apis/fhir/Patient', dataType: 'json', headers: { 'apicsrftoken': @@ -45,7 +45,7 @@ function testAjaxApi() { } function testFetchApi() { - fetch('../../apis/api/facility', { + fetch('../../apis/fhir/Patient', { credentials: 'same-origin', method: 'GET', headers: new Headers({ @@ -96,16 +96,19 @@ function testFetchApi() { $gbl::setNotRestCall(); $restRequest = new HttpRestRequest($gbl, $_SERVER); $restRequest->setRequestMethod("GET"); -$restRequest->setRequestURI("/fhir/encounter"); +$restRequest->setApiType("fhir"); +$restRequest->setRequestPath("/fhir/Patient"); +$restRequest->setIsLocalApi(true); $getParams = $restRequest->getQueryParams(); + // below will return as json echo "api via route handler call returning json:
"; -echo HttpRestRouteHandler::dispatch($gbl::$ROUTE_MAP, $restRequest, 'direct-json'); +echo HttpRestRouteHandler::dispatch($gbl::$FHIR_ROUTE_MAP, $restRequest, 'direct-json'); echo "

"; // below will return as php array echo "api via route handler call returning php array:
"; -echo print_r(HttpRestRouteHandler::dispatch($gbl::$ROUTE_MAP, $restRequest, 'direct')); +echo print_r(HttpRestRouteHandler::dispatch($gbl::$FHIR_ROUTE_MAP, $restRequest, 'direct')); echo "

";