Skip to content

Commit 122c278

Browse files
committed
Bug - Fixed falsy E2E test case
1 parent 6569353 commit 122c278

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

tests/E2E/Controller/v1/Profile/GroupsControllerTest.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,12 @@ static function (stdClass $userGroup): string {
141141
* @throws JsonException
142142
*/
143143
#[DataProvider('dataProviderTestThatGroupsActionReturnExpectedWithValidApiKey')]
144-
#[TestDox('Test that `GET /v1/profile/groups` request returns `401` with valid `$token` API key token')]
145-
public function testThatGroupsActionReturnExpectedWithValidApiKey(string $token): void
144+
#[TestDox(
145+
'Test that `GET /v1/profile/groups` request returns `401` with valid `$token` API key token ($role - ROLE)'
146+
)]
147+
public function testThatGroupsActionReturnExpectedWithValidApiKey(string $token, string $role): void
146148
{
147-
$client = $this->getApiKeyClient($token);
149+
$client = $this->getApiKeyClient($role);
148150
$client->request('GET', $this->baseUrl);
149151

150152
$response = $client->getResponse();
@@ -163,7 +165,7 @@ public function testThatGroupsActionReturnExpectedWithValidApiKey(string $token)
163165
self::assertSame(401, $responseContent->code, 'Response code was not expected' . $info);
164166
self::assertTrue(property_exists($responseContent, 'message'), 'Response does not contain "message"' . $info);
165167
self::assertSame(
166-
'JWT Token not found',
168+
'Invalid API key',
167169
$responseContent->message,
168170
'Response message was not expected' . $info,
169171
);
@@ -202,10 +204,10 @@ public static function dataProviderTestThatGroupsActionReturnExpectedWithValidAp
202204

203205
if (getenv('USE_ALL_USER_COMBINATIONS') === 'yes') {
204206
foreach ($rolesService->getRoles() as $role) {
205-
yield [str_pad($rolesService->getShort($role), 40, '_')];
207+
yield [str_pad($rolesService->getShort($role), 40, '_'), $role];
206208
}
207209
} else {
208-
yield [str_pad($rolesService->getShort(Role::LOGGED->value), 40, '_')];
210+
yield [str_pad($rolesService->getShort(Role::LOGGED->value), 40, '_'), Role::LOGGED->value];
209211
}
210212
}
211213

0 commit comments

Comments
 (0)