diff --git a/src/Controller/Admin/BlogController.php b/src/Controller/Admin/BlogController.php index b40984a07..8dd7b2e21 100644 --- a/src/Controller/Admin/BlogController.php +++ b/src/Controller/Admin/BlogController.php @@ -103,10 +103,10 @@ public function new( $submit = $form->get('saveAndCreateNew'); if ($submit->isClicked()) { - return $this->redirectToRoute('admin_post_new'); + return $this->redirectToRoute('admin_post_new', [], Response::HTTP_SEE_OTHER); } - return $this->redirectToRoute('admin_post_index'); + return $this->redirectToRoute('admin_post_index', [], Response::HTTP_SEE_OTHER); } return $this->render('admin/blog/new.html.twig', [ @@ -144,7 +144,7 @@ public function edit(Request $request, Post $post, EntityManagerInterface $entit $entityManager->flush(); $this->addFlash('success', 'post.updated_successfully'); - return $this->redirectToRoute('admin_post_edit', ['id' => $post->getId()]); + return $this->redirectToRoute('admin_post_edit', ['id' => $post->getId()], Response::HTTP_SEE_OTHER); } return $this->render('admin/blog/edit.html.twig', [ @@ -164,7 +164,7 @@ public function delete(Request $request, Post $post, EntityManagerInterface $ent $token = $request->request->get('token'); if (!$this->isCsrfTokenValid('delete', $token)) { - return $this->redirectToRoute('admin_post_index'); + return $this->redirectToRoute('admin_post_index', [], Response::HTTP_SEE_OTHER); } // Delete the tags associated with this blog post. This is done automatically @@ -177,6 +177,6 @@ public function delete(Request $request, Post $post, EntityManagerInterface $ent $this->addFlash('success', 'post.deleted_successfully'); - return $this->redirectToRoute('admin_post_index'); + return $this->redirectToRoute('admin_post_index', [], Response::HTTP_SEE_OTHER); } } diff --git a/src/Controller/BlogController.php b/src/Controller/BlogController.php index 2b9d959b1..3df90b2f5 100644 --- a/src/Controller/BlogController.php +++ b/src/Controller/BlogController.php @@ -129,7 +129,7 @@ public function commentNew( // See https://symfony.com/doc/current/messenger.html $eventDispatcher->dispatch(new CommentCreatedEvent($comment)); - return $this->redirectToRoute('blog_post', ['slug' => $post->getSlug()]); + return $this->redirectToRoute('blog_post', ['slug' => $post->getSlug()], Response::HTTP_SEE_OTHER); } return $this->render('blog/comment_form_error.html.twig', [ diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 6c2879f87..f36967b42 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -48,7 +48,7 @@ public function edit( $this->addFlash('success', 'user.updated_successfully'); - return $this->redirectToRoute('user_edit'); + return $this->redirectToRoute('user_edit', [], Response::HTTP_SEE_OTHER); } return $this->render('user/edit.html.twig', [ diff --git a/tests/Controller/Admin/BlogControllerTest.php b/tests/Controller/Admin/BlogControllerTest.php index d86368c2a..7f3618da2 100644 --- a/tests/Controller/Admin/BlogControllerTest.php +++ b/tests/Controller/Admin/BlogControllerTest.php @@ -105,7 +105,7 @@ public function testAdminNewPost(): void 'post[content]' => $postContent, ]); - $this->assertResponseRedirects('/en/admin/post/', Response::HTTP_FOUND); + $this->assertResponseRedirects('/en/admin/post/', Response::HTTP_SEE_OTHER); /** @var PostRepository $postRepository */ $postRepository = static::getContainer()->get(PostRepository::class); @@ -161,7 +161,7 @@ public function testAdminEditPost(): void 'post[title]' => $newBlogPostTitle, ]); - $this->assertResponseRedirects('/en/admin/post/1/edit', Response::HTTP_FOUND); + $this->assertResponseRedirects('/en/admin/post/1/edit', Response::HTTP_SEE_OTHER); /** @var PostRepository $postRepository */ $postRepository = static::getContainer()->get(PostRepository::class); @@ -183,7 +183,7 @@ public function testAdminDeletePost(): void $crawler = $this->client->request('GET', '/en/admin/post/1'); $this->client->submit($crawler->filter('#delete-form')->form()); - $this->assertResponseRedirects('/en/admin/post/', Response::HTTP_FOUND); + $this->assertResponseRedirects('/en/admin/post/', Response::HTTP_SEE_OTHER); /** @var PostRepository $postRepository */ $postRepository = static::getContainer()->get(PostRepository::class); diff --git a/tests/Controller/UserControllerTest.php b/tests/Controller/UserControllerTest.php index 8a73c4332..023071fe7 100644 --- a/tests/Controller/UserControllerTest.php +++ b/tests/Controller/UserControllerTest.php @@ -73,7 +73,7 @@ public function testEditUser(): void 'user[email]' => $newUserEmail, ]); - $this->assertResponseRedirects('/en/profile/edit', Response::HTTP_FOUND); + $this->assertResponseRedirects('/en/profile/edit', Response::HTTP_SEE_OTHER); /** @var User $user */ $user = $userRepository->findOneByEmail($newUserEmail);