/**
  * @Route("/animal", name="createPageAnimal_route")
  * @Method("POST")
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function createAction()
 {
     /** @var AnonymousToken $token */
     $token = $this->tokenStorage->getToken();
     /** @var User $user */
     $user = $token->getUser();
     $pageAnimal = $this->pageAnimalService->create($user);
     return new Response($this->serializer->serialize($pageAnimal, 'json'));
 }
 public function testCreate_Success()
 {
     $this->timeService->lockNow();
     $owner = new User();
     /** @var PageAnimal $pageAnimal */
     $pageAnimal = $this->pageAnimalService->create($owner);
     $this->assertEquals($owner, $pageAnimal->getOwner());
     $this->assertEquals($this->timeService->now(), $pageAnimal->getDateNaissance());
     $this->assertNotEmpty($pageAnimal->getNom());
     $this->assertEquals(PageAnimal::MALE, $pageAnimal->getSexe());
     $this->assertEmpty($pageAnimal->getDescription());
     $this->assertEquals(PageAnimal::DISPONIBLE, $pageAnimal->getStatut());
     $this->assertEmpty($pageAnimal->getPhotos());
 }