Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
5 / 5 |
| SecurityController | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
| loginAction | |
100.00% |
1 / 1 |
1 | |
100.00% |
5 / 5 |
|||
| <?php | |
| namespace App\Controller; | |
| use Symfony\Component\HttpFoundation\Request; | |
| use Symfony\Component\Routing\Annotation\Route; | |
| use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; | |
| use Symfony\Component\Security\Http\Authentication\AuthenticationUtils; | |
| use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; | |
| use Symfony\Component\HttpFoundation\Response; | |
| class SecurityController extends AbstractController | |
| { | |
| /** | |
| * @Route("/login", name="login", methods={"GET","POST"}) | |
| * @return Response | |
| */ | |
| public function loginAction(Request $request, AuthenticationUtils $authenticationUtils): Response | |
| { | |
| $error = $authenticationUtils->getLastAuthenticationError(); | |
| $lastUsername = $authenticationUtils->getLastUsername(); | |
| return $this->render('security/login.html.twig', array( | |
| 'last_username' => $lastUsername, | |
| 'error' => $error, | |
| )); | |
| } | |
| // Doc PhpUnit : Les annotations @codeCoverageIgnore, @codeCoverageIgnoreStart et @codeCoverageIgnoreEnd peuvent être utilisées pour exclure des lignes de code de l’analyse de couverture. | |
| // NOUVEAU PARAMÉTRAGE DANS SECURITY.YAML | |
| /** | |
| * @Route("/login_check", name="login_check") | |
| * @codeCoverageIgnore | |
| */ | |
| /* public function loginCheck() | |
| { | |
| // This code is never executed. | |
| } */ | |
| // NOUVEAU PARAMÉTRAGE DANS ROUTES.YAML | |
| /** | |
| * @Route("/logout", name="logout") | |
| * @codeCoverageIgnore | |
| */ | |
| /* public function logoutCheck() | |
| { | |
| // This code is never executed. | |
| } */ | |
| } |