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