Skip to content

Commit

Permalink
Update ApiClient enabled constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
jolelievre committed Jan 20, 2025
1 parent b050382 commit ded06b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/ApiPlatform/Resources/ApiClient/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ApiClient

public ?string $externalIssuer;

#[Assert\NotBlank(groups: ['Create'])]
#[Assert\NotNull(groups: ['Create'])]
public bool $enabled;

#[Assert\NotBlank(groups: ['Create'])]
Expand Down
17 changes: 9 additions & 8 deletions tests/Integration/ApiPlatform/ApiClientEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public function testAddApiClient(): int
'clientId' => 'client_id_test',
'clientName' => 'Client name test',
'description' => 'Client description test',
'enabled' => true,
// Check that false can be used (previously bug because of a NotBlank constraint)
'enabled' => false,
'lifetime' => 3600,
'scopes' => [
'api_client_read',
Expand Down Expand Up @@ -121,7 +122,7 @@ public function testGetApiClient(int $apiClientId): int
'clientName' => 'Client name test',
'description' => 'Client description test',
'externalIssuer' => null,
'enabled' => true,
'enabled' => false,
'lifetime' => 3600,
'scopes' => [
'api_client_read',
Expand Down Expand Up @@ -152,7 +153,7 @@ public function testUpdateApiClient(int $apiClientId): int
'clientId' => 'client_id_test_updated',
'clientName' => 'Client name test updated',
'description' => 'Client description test updated',
'enabled' => false,
'enabled' => true,
'lifetime' => 1800,
'scopes' => [
'api_client_write',
Expand All @@ -172,7 +173,7 @@ public function testUpdateApiClient(int $apiClientId): int
'clientName' => 'Client name test updated',
'description' => 'Client description test updated',
'externalIssuer' => null,
'enabled' => false,
'enabled' => true,
'lifetime' => 1800,
'scopes' => [
'api_client_write',
Expand Down Expand Up @@ -203,7 +204,7 @@ public function testUpdateApiClient(int $apiClientId): int
'clientName' => 'Client name test updated',
'description' => 'Client description test partially updated',
'externalIssuer' => null,
'enabled' => false,
'enabled' => true,
'lifetime' => 900,
'scopes' => [
'api_client_write',
Expand Down Expand Up @@ -240,7 +241,7 @@ public function testGetUpdatedApiClient(int $apiClientId): int
'clientName' => 'Client name test updated',
'description' => 'Client description test partially updated',
'externalIssuer' => null,
'enabled' => false,
'enabled' => true,
'lifetime' => 900,
'scopes' => [
'api_client_write',
Expand Down Expand Up @@ -274,7 +275,7 @@ public function testListApiClients(int $apiClientId): int
'clientName' => 'Client name test updated',
'description' => 'Client description test partially updated',
'externalIssuer' => null,
'enabled' => false,
'enabled' => true,
'lifetime' => 900,
],
$apiClients['items'][1],
Expand Down Expand Up @@ -368,7 +369,7 @@ public function testCreateInvalidApiClient(): void
],
[
'propertyPath' => 'enabled',
'message' => 'This value should not be blank.',
'message' => 'This value should not be null.',
],
[
'propertyPath' => 'description',
Expand Down

0 comments on commit ded06b3

Please sign in to comment.