diff options
author | Joas Schilling <coding@schilljs.com> | 2024-05-16 19:05:14 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2024-05-16 19:05:14 +0200 |
commit | 2a38ba10f7debca739179b6b036420a1b2542835 (patch) | |
tree | 14f85787d9c7513672e66d6d940d32d5678df2db | |
parent | 377a2f91d5661b2c9f4599f3f53269f1b36d9ab2 (diff) |
fix: Fix Psalm, OpenAPI and unit tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/Controller/CallController.php | 2 | ||||
-rw-r--r-- | openapi-full.json | 20 | ||||
-rw-r--r-- | openapi.json | 20 | ||||
-rw-r--r-- | src/types/openapi/openapi-full.ts | 4 | ||||
-rw-r--r-- | src/types/openapi/openapi.ts | 4 | ||||
-rw-r--r-- | tests/php/Service/ParticipantServiceTest.php | 6 |
6 files changed, 42 insertions, 14 deletions
diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php index 805bd047f..6e5021bb2 100644 --- a/lib/Controller/CallController.php +++ b/lib/Controller/CallController.php @@ -162,7 +162,7 @@ class CallController extends AEnvironmentAwareController { * 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 diff --git a/openapi-full.json b/openapi-full.json index 8aec51d89..f1a25c4f4 100644 --- a/openapi-full.json +++ b/openapi-full.json @@ -4045,8 +4045,8 @@ } } }, - "400": { - "description": "Ringing attendee is not possible", + "404": { + "description": "Attendee could not be found", "content": { "application/json": { "schema": { @@ -4073,8 +4073,8 @@ } } }, - "404": { - "description": "Attendee could not be found", + "400": { + "description": "Ringing attendee is not possible", "content": { "application/json": { "schema": { @@ -4093,7 +4093,17 @@ "meta": { "$ref": "#/components/schemas/OCSMeta" }, - "data": {} + "data": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } } } } diff --git a/openapi.json b/openapi.json index a0d74b9d1..61cf9f21f 100644 --- a/openapi.json +++ b/openapi.json @@ -3932,8 +3932,8 @@ } } }, - "400": { - "description": "Ringing attendee is not possible", + "404": { + "description": "Attendee could not be found", "content": { "application/json": { "schema": { @@ -3960,8 +3960,8 @@ } } }, - "404": { - "description": "Attendee could not be found", + "400": { + "description": "Ringing attendee is not possible", "content": { "application/json": { "schema": { @@ -3980,7 +3980,17 @@ "meta": { "$ref": "#/components/schemas/OCSMeta" }, - "data": {} + "data": { + "type": "object", + "required": [ + "error" + ], + "properties": { + "error": { + "type": "string" + } + } + } } } } diff --git a/src/types/openapi/openapi-full.ts b/src/types/openapi/openapi-full.ts index 66bd34df6..ddf13c64a 100644 --- a/src/types/openapi/openapi-full.ts +++ b/src/types/openapi/openapi-full.ts @@ -1796,7 +1796,9 @@ export type operations = { "application/json": { ocs: { meta: components["schemas"]["OCSMeta"]; - data: unknown; + data: { + error: string; + }; }; }; }; diff --git a/src/types/openapi/openapi.ts b/src/types/openapi/openapi.ts index 86e715f60..8370ecec7 100644 --- a/src/types/openapi/openapi.ts +++ b/src/types/openapi/openapi.ts @@ -1619,7 +1619,9 @@ export type operations = { "application/json": { ocs: { meta: components["schemas"]["OCSMeta"]; - data: unknown; + data: { + error: string; + }; }; }; }; diff --git a/tests/php/Service/ParticipantServiceTest.php b/tests/php/Service/ParticipantServiceTest.php index ca75f26b7..9a68aae11 100644 --- a/tests/php/Service/ParticipantServiceTest.php +++ b/tests/php/Service/ParticipantServiceTest.php @@ -29,6 +29,7 @@ use OCP\IDBConnection; use OCP\IGroupManager; use OCP\IUserManager; use OCP\Security\ISecureRandom; +use OCP\UserStatus\IManager; use PHPUnit\Framework\MockObject\MockObject; use Test\TestCase; @@ -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; @@ -70,6 +72,7 @@ class ParticipantServiceTest extends TestCase { $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, @@ -85,7 +88,8 @@ class ParticipantServiceTest extends TestCase { $this->membershipService, $this->federationBackendNotifier, $this->time, - $this->cacheFactory + $this->cacheFactory, + $this->userStatusManager, ); } |