Fix calls to templating service

This commit is contained in:
Julien Fastré 2023-08-02 22:49:02 +02:00
parent f2d391ea2e
commit 24cc6a816b
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 10 additions and 3 deletions

View File

@ -33,6 +33,7 @@ use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Form; use Symfony\Component\Form\Form;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionBagInterface;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Routing\Annotation\Route; use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\Security;
@ -55,7 +56,7 @@ final class PersonController extends AbstractController
private readonly PersonRepository $personRepository, private readonly PersonRepository $personRepository,
private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper, private readonly ConfigPersonAltNamesHelper $configPersonAltNameHelper,
private readonly ValidatorInterface $validator, 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() $this->get('session')->getFlashBag()
->add( ->add(
'success', 'success',
$this->get('translator') $this->translator
->trans('The person data has been updated') ->trans('The person data has been updated')
); );

View File

@ -16,6 +16,7 @@ use Chill\MainBundle\Test\PrepareClientTrait;
use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Person;
use Closure; use Closure;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
/** /**
@ -30,6 +31,8 @@ final class PersonControllerUpdateTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
private KernelBrowser $client;
/** /**
* @var string The url using for editing the person's information * @var string The url using for editing the person's information
*/ */
@ -218,10 +221,13 @@ final class PersonControllerUpdateTest extends WebTestCase
); );
$crawler = $this->client->followRedirect(); $crawler = $this->client->followRedirect();
self::assertTrue($this->client->getResponse()->isSuccessful());
$this->assertGreaterThan( $this->assertGreaterThan(
0, 0,
$crawler->filter('.alert-success')->count(), $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 if ('birthdate' === $field || 'memo' === $field || 'countryOfBirth' === $field || 'nationality' === $field