Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lib/UserManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -1419,13 +1419,15 @@ public function listSessions(string $userId, array $options = [])
*/
public function revokeSession(string $sessionId)
{
$path = "user_management/sessions/{$sessionId}/revoke";
$path = "user_management/sessions/revoke";

$response = Client::request(
Client::METHOD_POST,
$path,
null,
null,
[
"session_id" => $sessionId,
],
Comment on lines +1428 to +1430

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test not updated to match

The corresponding test in tests/WorkOS/UserManagementTest.php:2269-2293 still uses the old path ("user_management/sessions/{$sessionId}/revoke") and passes null as the params argument. The mock expectation won't match the actual call being made now. Please update testRevokeSession to use the new path and pass ["session_id" => $sessionId] as params.

Additionally, the array here uses 2-space indentation, while the rest of the codebase consistently uses 4-space indentation for array contents. Consider aligning to match:

Suggested change
[
"session_id" => $sessionId,
],
[
"session_id" => $sessionId,
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

true
);

Expand Down
4 changes: 2 additions & 2 deletions tests/WorkOS/UserManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@ public function testListSessions()
public function testRevokeSession()
{
$sessionId = "session_01H7X1M4TZJN5N4HG4XXMA1234";
$path = "user_management/sessions/{$sessionId}/revoke";
$path = "user_management/sessions/revoke";

$result = json_encode([
"id" => $sessionId,
Expand All @@ -2287,7 +2287,7 @@ public function testRevokeSession()
Client::METHOD_POST,
$path,
null,
null,
[ "session_id" => $sessionId ],
true,
$result
);
Expand Down