From 24cc6a816b1e36b8e24fc84edf075b6d02836938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 2 Aug 2023 22:49:02 +0200 Subject: [PATCH] Fix calls to templating service --- .../ChillPersonBundle/Controller/PersonController.php | 5 +++-- .../Tests/Controller/PersonControllerUpdateTest.php | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/PersonController.php b/src/Bundle/ChillPersonBundle/Controller/PersonController.php index 97b2c3ab1..41e4125fd 100644 --- a/src/Bundle/ChillPersonBundle/Controller/PersonController.php +++ b/src/Bundle/ChillPersonBundle/Controller/PersonController.php @@ -33,6 +33,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Form; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\SessionBagInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Security\Core\Security; @@ -55,7 +56,7 @@ final class PersonController extends AbstractController private readonly PersonRepository $personRepository, private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, private readonly ValidatorInterface $validator, - private readonly EntityManagerInterface $em + private readonly EntityManagerInterface $em, ) { } @@ -96,7 +97,7 @@ final class PersonController extends AbstractController $this->get('session')->getFlashBag() ->add( 'success', - $this->get('translator') + $this->translator ->trans('The person data has been updated') ); diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php index 12afd5ca2..03a9bc1df 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateTest.php @@ -16,6 +16,7 @@ use Chill\MainBundle\Test\PrepareClientTrait; use Chill\PersonBundle\Entity\Person; use Closure; use Doctrine\ORM\EntityManagerInterface; +use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; /** @@ -30,6 +31,8 @@ final class PersonControllerUpdateTest extends WebTestCase { use PrepareClientTrait; + private KernelBrowser $client; + /** * @var string The url using for editing the person's information */ @@ -218,10 +221,13 @@ final class PersonControllerUpdateTest extends WebTestCase ); $crawler = $this->client->followRedirect(); + + self::assertTrue($this->client->getResponse()->isSuccessful()); + $this->assertGreaterThan( 0, $crawler->filter('.alert-success')->count(), - 'a element .success is shown' + 'an element .alert-success is shown' ); if ('birthdate' === $field || 'memo' === $field || 'countryOfBirth' === $field || 'nationality' === $field