summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2022-07-05 17:47:49 +0200
committerJoas Schilling <coding@schilljs.com>2022-07-06 22:49:34 +0200
commit050a190a5f147ff15e4354d6ab244ba69cd24bbb (patch)
treeea460cb79b716f0313d1d6c2295d10da93215a83 /tests
parentcdfccfe21f9f0255116a66f3e255e6d5dfe1b578 (diff)
Make sure the roomId is an int
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/spreedcheats/lib/Controller/ApiController.php10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/integration/spreedcheats/lib/Controller/ApiController.php b/tests/integration/spreedcheats/lib/Controller/ApiController.php
index fbaab0cf1..ff4d6c9de 100644
--- a/tests/integration/spreedcheats/lib/Controller/ApiController.php
+++ b/tests/integration/spreedcheats/lib/Controller/ApiController.php
@@ -121,7 +121,7 @@ class ApiController extends OCSController {
->where(
$query->expr()->andX(
$query->expr()->eq('class', $query->createNamedParameter(ExpireChatMessages::class)),
- $query->expr()->eq('argument', $query->createNamedParameter(json_encode(['room_id' => (int) $roomId])))
+ $query->expr()->eq('argument', $query->createNamedParameter(json_encode(['room_id' => $roomId])))
)
);
$result = $query->executeQuery();
@@ -132,12 +132,16 @@ class ApiController extends OCSController {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
- private function getRoomIdByToken(string $token): ?string {
+ private function getRoomIdByToken(string $token): ?int {
$query = $this->db->getQueryBuilder();
$query->select('id')
->from('talk_rooms')
->where($query->expr()->eq('token', $query->createNamedParameter($token)));
+
$result = $query->executeQuery();
- return $result->fetchOne();
+ $roomId = (int) $result->fetchOne();
+ $result->closeCursor();
+
+ return $roomId;
}
}