Skip to content

Commit

Permalink
Get around json parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
keithbauer committed Oct 28, 2024
1 parent 3e0fc68 commit d554c9f
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions tests/Mocks/MockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,21 @@ public static function setMockContainer()
$injectionFactory = new InjectionFactory($resolver);
self::$mockContainer = new ServiceContainer($injectionFactory);

$headers = [
'X-NYPL-Identity' =>
'{"token":"blah","identity":{"sub":null,"scope":"openid offline_access api read:hold_request"}}'
$_POST = [
'itemBarcode' => '1234567890123',
'owningInstitutionId' => 'NYPL',
'cancelRequestId' => '1234567890',
'jobId' => '991873slx938'
];
$body = '{"itemBarcode": "1234567890123", "owningInstitutionId": "NYPL", "cancelRequestId": "1234567890", "jobId": "991873slx938"}';
self::$mockContainer->set("request", new ServerRequest('POST', '/', $headers, $body));
$_SERVER = [
'REQUEST_METHOD' => 'POST',
'REQUEST_URI' => '/',
'HTTP_ACCEPT' => 'application/json',
'HTTP_CONTENT_TYPE' => 'application/json',
'HTTP_X_NYPL_IDENTITY' => '{"token":"blah","identity":{"sub":null,"scope":"openid offline_access api read:hold_request"}}'
];
$request = ServerRequest::fromGlobals();
self::$mockContainer->set("request", $request);
self::$mockContainer->set("response", new Response(200));

}
Expand Down

0 comments on commit d554c9f

Please sign in to comment.