diff --git a/api/src/Entity/User.php b/api/src/Entity/User.php index 37acc9c5cc..6340cfb5d5 100644 --- a/api/src/Entity/User.php +++ b/api/src/Entity/User.php @@ -32,7 +32,8 @@ new Patch( processor: UserActivateProcessor::class, uriTemplate: 'users/{id}/activate{._format}', - denormalizationContext: ['groups' => ['activate']] + denormalizationContext: ['groups' => ['activate']], + output: User::class ), new Get( security: 'is_authenticated()' diff --git a/api/src/Serializer/Normalizer/UriTemplateNormalizer.php b/api/src/Serializer/Normalizer/UriTemplateNormalizer.php index 07ea48f51b..fe3fb50be4 100644 --- a/api/src/Serializer/Normalizer/UriTemplateNormalizer.php +++ b/api/src/Serializer/Normalizer/UriTemplateNormalizer.php @@ -52,7 +52,7 @@ public function normalize($object, $format = null, array $context = []): array|s $result['_links']['oauthGoogle'] = ['href' => $this->urlGenerator->generate('connect_google_start').'{?callback}', 'templated' => true]; $result['_links']['oauthPbsmidata'] = ['href' => $this->urlGenerator->generate('connect_pbsmidata_start').'{?callback}', 'templated' => true]; $result['_links']['oauthCevidb'] = ['href' => $this->urlGenerator->generate('connect_cevidb_start').'{?callback}', 'templated' => true]; - $result['_links']['resetPassword'] = ['href' => $this->urlGenerator->generate('_api_/reset_password{._format}_post').'{/id}', 'templated' => true]; + $result['_links']['resetPassword'] = ['href' => $this->urlGenerator->generate('_api_/auth/reset_password{._format}_post').'{/id}', 'templated' => true]; return $result; } diff --git a/api/tests/Api/ContentNodes/ContentNode/CreateContentNodeTest.php b/api/tests/Api/ContentNodes/ContentNode/CreateContentNodeTest.php index 0ed6549e07..9f44a1295c 100644 --- a/api/tests/Api/ContentNodes/ContentNode/CreateContentNodeTest.php +++ b/api/tests/Api/ContentNodes/ContentNode/CreateContentNodeTest.php @@ -9,7 +9,7 @@ */ class CreateContentNodeTest extends ECampApiTestCase { public function testCreateContentNodeIsNotAllowed() { - static::createClientWithCredentials()->request('POST', '/content_node/content_nodes', ['json' => []]); + static::createClientWithCredentials()->request('POST', '/content_nodes', ['json' => []]); $this->assertResponseStatusCodeSame(405); } } diff --git a/api/tests/Api/Invitations/AcceptInvitationTest.php b/api/tests/Api/Invitations/AcceptInvitationTest.php index 80324c3319..5b800d4c7f 100644 --- a/api/tests/Api/Invitations/AcceptInvitationTest.php +++ b/api/tests/Api/Invitations/AcceptInvitationTest.php @@ -50,13 +50,8 @@ public function testAcceptInvitationSuccess() { 'headers' => ['Content-Type' => 'application/merge-patch+json'], ] ); - $this->assertResponseStatusCodeSame(200); // TO DISCUSS: Wouldn't it be better to get a 204 here? The invitation doesn't really exist anymore after successful acceptance + $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ - /* - 'campId' => $campCollaboration->camp->getId(), - 'campTitle' => $campCollaboration->camp->title, - 'userDisplayName' => 'Bi-Pi', - 'userAlreadyInCamp' => false, */ '_links' => [ 'self' => ['href' => "/invitations/{$campCollaboration->inviteKey}/find"], ], diff --git a/api/tests/Api/Invitations/RejectInvitationTest.php b/api/tests/Api/Invitations/RejectInvitationTest.php index d8761beb71..f25188930e 100644 --- a/api/tests/Api/Invitations/RejectInvitationTest.php +++ b/api/tests/Api/Invitations/RejectInvitationTest.php @@ -33,13 +33,8 @@ public function testRejectInvitationSucceedsWhenNotLoggedIn() { 'headers' => ['Content-Type' => 'application/merge-patch+json'], ] ); - $this->assertResponseStatusCodeSame(200); // // TO DISCUSS: Wouldn't it be better to get a 204 here? The invitation doesn't really exist anymore after successful acceptance + $this->assertResponseStatusCodeSame(200); $this->assertJsonContains([ - /* - 'campId' => $campCollaboration->camp->getId(), - 'campTitle' => $campCollaboration->camp->title, - 'userDisplayName' => null, - 'userAlreadyInCamp' => null,*/ '_links' => [ 'self' => ['href' => "/invitations/{$campCollaboration->inviteKey}/find"], ], diff --git a/api/tests/Api/Profiles/CreateProfileTest.php b/api/tests/Api/Profiles/CreateProfileTest.php index 778af9bb87..ab86e137c7 100644 --- a/api/tests/Api/Profiles/CreateProfileTest.php +++ b/api/tests/Api/Profiles/CreateProfileTest.php @@ -2,8 +2,6 @@ namespace App\Tests\Api\Profiles; -use ApiPlatform\Metadata\Post; -use App\Entity\Profile; use App\Tests\Api\ECampApiTestCase; /** @@ -11,12 +9,8 @@ */ class CreateProfileTest extends ECampApiTestCase { public function testCreateProfileIsNotAllowed() { - static::createClientWithCredentials()->request('POST', '/profiles', ['json' => $this->getExampleWritePayload()]); + static::createClientWithCredentials()->request('POST', '/profiles', ['json' => []]); $this->assertResponseStatusCodeSame(405); } - - public function getExampleWritePayload($attributes = [], $except = []) { - return $this->getExamplePayload(Profile::class, Post::class, $attributes, [], $except); - } }