Skip to content

Commit

Permalink
fix: Fix Psalm, OpenAPI and unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed May 16, 2024
1 parent 377a2f9 commit 2a38ba1
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function joinCall(?int $flags = null, ?int $forcePermissions = null, bool
* Ring an attendee
*
* @param int $attendeeId ID of the attendee to ring
* @return DataResponse<Http::STATUS_OK|Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, array<empty>, array{}>
* @return DataResponse<Http::STATUS_OK|Http::STATUS_NOT_FOUND, array<empty>, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, array{error: string}, array{}>
*
* 200: Attendee rang successfully
* 400: Ringing attendee is not possible
Expand Down
20 changes: 15 additions & 5 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -4045,8 +4045,8 @@
}
}
},
"400": {
"description": "Ringing attendee is not possible",
"404": {
"description": "Attendee could not be found",
"content": {
"application/json": {
"schema": {
Expand All @@ -4073,8 +4073,8 @@
}
}
},
"404": {
"description": "Attendee could not be found",
"400": {
"description": "Ringing attendee is not possible",
"content": {
"application/json": {
"schema": {
Expand All @@ -4093,7 +4093,17 @@
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
"data": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
}
}
}
}
}
Expand Down
20 changes: 15 additions & 5 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -3932,8 +3932,8 @@
}
}
},
"400": {
"description": "Ringing attendee is not possible",
"404": {
"description": "Attendee could not be found",
"content": {
"application/json": {
"schema": {
Expand All @@ -3960,8 +3960,8 @@
}
}
},
"404": {
"description": "Attendee could not be found",
"400": {
"description": "Ringing attendee is not possible",
"content": {
"application/json": {
"schema": {
Expand All @@ -3980,7 +3980,17 @@
"meta": {
"$ref": "#/components/schemas/OCSMeta"
},
"data": {}
"data": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "string"
}
}
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1796,7 +1796,9 @@ export type operations = {
"application/json": {
ocs: {
meta: components["schemas"]["OCSMeta"];
data: unknown;
data: {
error: string;
};
};
};
};
Expand Down
4 changes: 3 additions & 1 deletion src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,9 @@ export type operations = {
"application/json": {
ocs: {
meta: components["schemas"]["OCSMeta"];
data: unknown;
data: {
error: string;
};
};
};
};
Expand Down
6 changes: 5 additions & 1 deletion tests/php/Service/ParticipantServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCP\IGroupManager;
use OCP\IUserManager;
use OCP\Security\ISecureRandom;
use OCP\UserStatus\IManager;
use PHPUnit\Framework\MockObject\MockObject;
use Test\TestCase;

Expand All @@ -50,6 +51,7 @@ class ParticipantServiceTest extends TestCase {
protected BackendNotifier&MockObject $federationBackendNotifier;
protected ITimeFactory&MockObject $time;
protected ICacheFactory&MockObject $cacheFactory;
protected IManager&MockObject $userStatusManager;
private ?ParticipantService $service = null;


Expand All @@ -70,6 +72,7 @@ public function setUp(): void {
$this->federationBackendNotifier = $this->createMock(BackendNotifier::class);
$this->time = $this->createMock(ITimeFactory::class);
$this->cacheFactory = $this->createMock(ICacheFactory::class);
$this->userStatusManager = $this->createMock(IManager::class);
$this->service = new ParticipantService(
$this->serverConfig,
$this->talkConfig,
Expand All @@ -85,7 +88,8 @@ public function setUp(): void {
$this->membershipService,
$this->federationBackendNotifier,
$this->time,
$this->cacheFactory
$this->cacheFactory,
$this->userStatusManager,
);
}

Expand Down

0 comments on commit 2a38ba1

Please sign in to comment.