Skip to content

Commit 3c948e9

Browse files
committed
PhpStan: Add test for non-string token in WOPI request.
1 parent 5308405 commit 3c948e9

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/src/Kernel/Controller/WopiControllerTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,30 @@ public function testMissingToken(): void {
364364
}
365365
}
366366

367+
/**
368+
* Tests different routes using a non-string 'token' query parameter.
369+
*
370+
* This can only happen if the requests comes from a source that is not
371+
* Collabora Online, or if an unexpected change was introduced in a new
372+
* version of Collabora Online.
373+
*
374+
* @covers ::wopiCheckFileInfo
375+
* @covers ::wopiGetFile
376+
* @covers ::wopiPutFile
377+
*/
378+
public function testNonStringToken(): void {
379+
$requests = $this->createRequests();
380+
foreach ($requests as $name => $request) {
381+
// Replace the token with a value that is not in the JWT format.
382+
$request->query->set('access_token', ['not a string']);
383+
$this->assertAccessDeniedResponse(
384+
'Expected a string access token, found array.',
385+
$request,
386+
$name,
387+
);
388+
}
389+
}
390+
367391
/**
368392
* Tests different routes using an invalid token.
369393
*

0 commit comments

Comments
 (0)