Problems with asserts (symfony 4.2.4 )When should assertions stay in production code?How do you assert that a certain exception is thrown in JUnit 4 tests?differences between 2 JUnit Assert classesHow do I use Assert to verify that an exception has been thrown?Best practice for Python assertWhat is the “assert” function?Is assert evil?What is the use of “assert” in Python?PHPUnit assert that an exception was thrown?What is “assert” in JavaScript?

An easy way to solve this limit of a sum?

How important is it for multiple POVs to run chronologically?

What's the big deal about the Nazgûl losing their horses?

As a supervisor, what feedback would you expect from a PhD who quits?

Is reasonable to assume that the 食 in 月食/日食 can be interpreted as the sun/moon being "eaten" during an eclipse?

I'm feeling like my character doesn't fit the campaign

Taking my Ph.D. advisor out for dinner after graduation

How did the IEC decide to create kibibytes?

Better random (unique) file name

Are "confidant" and "confident" homophones?

My professor has told me he will be the corresponding author. Will it hurt my future career?

Examples of fluid (including air) being used to transmit digital data?

Can a USB hub be used to access a drive from two devices?

Passwordless authentication - how invalidate login code

Did William Shakespeare hide things in his writings?

What is this airplane with small wings at different angles seen at Paphos Airport?

Is this car delivery via Ebay Motors on Craigslist a scam?

How to get the speed of my spaceship?

Tiny URL creator

How can I use my cell phone's light as a reading light?

Do I need transit visa for Dublin?

Does the sensor of a dslr count the number of photons that hits it?

Any way to meet code with 40.7% or 40.44% conduit fill?

How do I talk to my wife about unrealistic expectations?



Problems with asserts (symfony 4.2.4 )


When should assertions stay in production code?How do you assert that a certain exception is thrown in JUnit 4 tests?differences between 2 JUnit Assert classesHow do I use Assert to verify that an exception has been thrown?Best practice for Python assertWhat is the “assert” function?Is assert evil?What is the use of “assert” in Python?PHPUnit assert that an exception was thrown?What is “assert” in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have problems with my asserts, only a few works.



For example, it's ok with the Assert of "firstName", I have the error message, but I have nothing for lastName and "introduction".



Also, my EqualTo seems to be out :(.
Did i make mistake?



Entity



<?php

namespace AppEntity;

use AppEntityAd;
use CocurSlugifySlugify;
use DoctrineORMMapping as ORM;
use DoctrineCommonCollectionsCollection;
use DoctrineCommonCollectionsArrayCollection;
use SymfonyComponentValidatorConstraintsEqualTo;
use SymfonyComponentValidatorConstraints as Assert;
use SymfonyComponentSecurityCoreUserUserInterface;
use SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity;

/**
* @ORMEntity(repositoryClass="AppRepositoryUserRepository")
* @ORMHasLifecycleCallbacks()
* @UniqueEntity(fields="email", message= "User already exist")
*/
class User implements UserInterface

/**
* @ORMId()
* @ORMGeneratedValue()
* @ORMColumn(type="integer")
*/
private $id;

/**
* @ORMColumn(type="string", length=255)
* @AssertNotBlank(message="Champ Obligatoire")
* @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
* @AssertValid
* @AssertNotNull
*/
private $firstName;

/**
* @ORMColumn(type="string", length=255)
* @AssertNotBlank(message="Champ Obligatoire")
* @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
* @AssertValid
* @AssertNotNull
*/
private $lastName;

/**
* @ORMColumn(type="string", length=255)
* @AssertEmail()
*/
private $email;

/**
* @ORMColumn(type="string", length=255, nullable=true)
* @AssertUrl(message="Entrez une Url valide !")
*/
private $picture;

/**
* @ORMColumn(type="string", length=255)
*/
private $hash;

/**
* @ORMColumn(type="string", length=255)
* @AssertLength(min=10, minMessage="Au moins 10 lettres mon coco ! ")
*
*/
private $introduction;

/**
* @AssertEqualTo(propertyPath="hash")
*/
public $passwordConfirm;



/**
* @ORMColumn(type="string", length=255)
*/
private $slug;

/**
* @ORMOneToMany(targetEntity="AppEntityAd", mappedBy="author")
*/
private $ads;

/**
* Permet d'initialiser le slug
*
* @ORMPrePersist
* @ORMPreUpdate
*
* @return void
*/

public function initializeSlug()

if(empty($this->slug))
$slugify = new Slugify();
$this->slug = $slugify->slugify($this->firstName . ' ' . $this->lastName);




public function __construct()

$this->ads = new ArrayCollection();


public function getId(): ?int

return $this->id;


public function getFirstName(): ?string

return $this->firstName;


public function setFirstName(string $firstName): self

$this->firstName = $firstName;

return $this;


public function getLastName(): ?string

return $this->lastName;


public function setLastName(string $lastName): self

$this->lastName = $lastName;

return $this;


public function getEmail(): ?string

return $this->email;


public function setEmail(string $email): self

$this->email = $email;

return $this;


public function getPicture(): ?string

return $this->picture;


public function setPicture(?string $picture): self

$this->picture = $picture;

return $this;


public function getHash(): ?string

return $this->hash;


public function setHash(string $hash): self

$this->hash = $hash;

return $this;


public function getIntroduction(): ?string

return $this->introduction;


public function setIntroduction(string $introduction): self

$this->introduction = $introduction;

return $this;


public function getSlug(): ?string

return $this->slug;


public function setSlug(string $slug): self

$this->slug = $slug;

return $this;


/**
* @return Collection


Form




<?php

namespace AppForm;

use AppEntityUser;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentFormExtensionCoreTypeEmailType;
use SymfonyComponentFormExtensionCoreTypeUrlType;
use SymfonyComponentFormExtensionCoreTypePasswordType;

class RegistrationType extends ApplicationType


public function buildForm(FormBuilderInterface $builder, array $options)

$builder
->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

;


public function configureOptions(OptionsResolver $resolver)

$resolver->setDefaults([
'data_class' => User::class,
]);




Controller



<?php

namespace AppForm;

use AppEntityUser;
use SymfonyComponentFormAbstractType;
use SymfonyComponentFormFormBuilderInterface;
use SymfonyComponentOptionsResolverOptionsResolver;
use SymfonyComponentFormExtensionCoreTypeTextType;
use SymfonyComponentFormExtensionCoreTypeEmailType;
use SymfonyComponentFormExtensionCoreTypeUrlType;
use SymfonyComponentFormExtensionCoreTypePasswordType;

class RegistrationType extends ApplicationType


public function buildForm(FormBuilderInterface $builder, array $options)

$builder
->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

;


public function configureOptions(OptionsResolver $resolver)

$resolver->setDefaults([
'data_class' => User::class,
]);




Twig



% extends 'base.html.twig' %

% block title % Inscription % endblock %

% block body %

<div class="row">
<div class="col-md-3"></div>
<div class="col-md-6">
<div class="bg-dark py-3 px-3">
<h1>Inscrivez-vous sur notre site !</h1>


form_start(form)
form_widget(form)

<button type="submit" class="btn btn-success"> Confirmez votre inscription</button>
</div>
</div>
</div>
<br/><br/>

% endblock %


thank you for watching :)<3



I expected to have all my assert message workings.










share|improve this question






























    0















    I have problems with my asserts, only a few works.



    For example, it's ok with the Assert of "firstName", I have the error message, but I have nothing for lastName and "introduction".



    Also, my EqualTo seems to be out :(.
    Did i make mistake?



    Entity



    <?php

    namespace AppEntity;

    use AppEntityAd;
    use CocurSlugifySlugify;
    use DoctrineORMMapping as ORM;
    use DoctrineCommonCollectionsCollection;
    use DoctrineCommonCollectionsArrayCollection;
    use SymfonyComponentValidatorConstraintsEqualTo;
    use SymfonyComponentValidatorConstraints as Assert;
    use SymfonyComponentSecurityCoreUserUserInterface;
    use SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity;

    /**
    * @ORMEntity(repositoryClass="AppRepositoryUserRepository")
    * @ORMHasLifecycleCallbacks()
    * @UniqueEntity(fields="email", message= "User already exist")
    */
    class User implements UserInterface

    /**
    * @ORMId()
    * @ORMGeneratedValue()
    * @ORMColumn(type="integer")
    */
    private $id;

    /**
    * @ORMColumn(type="string", length=255)
    * @AssertNotBlank(message="Champ Obligatoire")
    * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
    * @AssertValid
    * @AssertNotNull
    */
    private $firstName;

    /**
    * @ORMColumn(type="string", length=255)
    * @AssertNotBlank(message="Champ Obligatoire")
    * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
    * @AssertValid
    * @AssertNotNull
    */
    private $lastName;

    /**
    * @ORMColumn(type="string", length=255)
    * @AssertEmail()
    */
    private $email;

    /**
    * @ORMColumn(type="string", length=255, nullable=true)
    * @AssertUrl(message="Entrez une Url valide !")
    */
    private $picture;

    /**
    * @ORMColumn(type="string", length=255)
    */
    private $hash;

    /**
    * @ORMColumn(type="string", length=255)
    * @AssertLength(min=10, minMessage="Au moins 10 lettres mon coco ! ")
    *
    */
    private $introduction;

    /**
    * @AssertEqualTo(propertyPath="hash")
    */
    public $passwordConfirm;



    /**
    * @ORMColumn(type="string", length=255)
    */
    private $slug;

    /**
    * @ORMOneToMany(targetEntity="AppEntityAd", mappedBy="author")
    */
    private $ads;

    /**
    * Permet d'initialiser le slug
    *
    * @ORMPrePersist
    * @ORMPreUpdate
    *
    * @return void
    */

    public function initializeSlug()

    if(empty($this->slug))
    $slugify = new Slugify();
    $this->slug = $slugify->slugify($this->firstName . ' ' . $this->lastName);




    public function __construct()

    $this->ads = new ArrayCollection();


    public function getId(): ?int

    return $this->id;


    public function getFirstName(): ?string

    return $this->firstName;


    public function setFirstName(string $firstName): self

    $this->firstName = $firstName;

    return $this;


    public function getLastName(): ?string

    return $this->lastName;


    public function setLastName(string $lastName): self

    $this->lastName = $lastName;

    return $this;


    public function getEmail(): ?string

    return $this->email;


    public function setEmail(string $email): self

    $this->email = $email;

    return $this;


    public function getPicture(): ?string

    return $this->picture;


    public function setPicture(?string $picture): self

    $this->picture = $picture;

    return $this;


    public function getHash(): ?string

    return $this->hash;


    public function setHash(string $hash): self

    $this->hash = $hash;

    return $this;


    public function getIntroduction(): ?string

    return $this->introduction;


    public function setIntroduction(string $introduction): self

    $this->introduction = $introduction;

    return $this;


    public function getSlug(): ?string

    return $this->slug;


    public function setSlug(string $slug): self

    $this->slug = $slug;

    return $this;


    /**
    * @return Collection


    Form




    <?php

    namespace AppForm;

    use AppEntityUser;
    use SymfonyComponentFormAbstractType;
    use SymfonyComponentFormFormBuilderInterface;
    use SymfonyComponentOptionsResolverOptionsResolver;
    use SymfonyComponentFormExtensionCoreTypeTextType;
    use SymfonyComponentFormExtensionCoreTypeEmailType;
    use SymfonyComponentFormExtensionCoreTypeUrlType;
    use SymfonyComponentFormExtensionCoreTypePasswordType;

    class RegistrationType extends ApplicationType


    public function buildForm(FormBuilderInterface $builder, array $options)

    $builder
    ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
    ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
    ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
    ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
    ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
    ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
    ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

    ;


    public function configureOptions(OptionsResolver $resolver)

    $resolver->setDefaults([
    'data_class' => User::class,
    ]);




    Controller



    <?php

    namespace AppForm;

    use AppEntityUser;
    use SymfonyComponentFormAbstractType;
    use SymfonyComponentFormFormBuilderInterface;
    use SymfonyComponentOptionsResolverOptionsResolver;
    use SymfonyComponentFormExtensionCoreTypeTextType;
    use SymfonyComponentFormExtensionCoreTypeEmailType;
    use SymfonyComponentFormExtensionCoreTypeUrlType;
    use SymfonyComponentFormExtensionCoreTypePasswordType;

    class RegistrationType extends ApplicationType


    public function buildForm(FormBuilderInterface $builder, array $options)

    $builder
    ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
    ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
    ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
    ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
    ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
    ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
    ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

    ;


    public function configureOptions(OptionsResolver $resolver)

    $resolver->setDefaults([
    'data_class' => User::class,
    ]);




    Twig



    % extends 'base.html.twig' %

    % block title % Inscription % endblock %

    % block body %

    <div class="row">
    <div class="col-md-3"></div>
    <div class="col-md-6">
    <div class="bg-dark py-3 px-3">
    <h1>Inscrivez-vous sur notre site !</h1>


    form_start(form)
    form_widget(form)

    <button type="submit" class="btn btn-success"> Confirmez votre inscription</button>
    </div>
    </div>
    </div>
    <br/><br/>

    % endblock %


    thank you for watching :)<3



    I expected to have all my assert message workings.










    share|improve this question


























      0












      0








      0








      I have problems with my asserts, only a few works.



      For example, it's ok with the Assert of "firstName", I have the error message, but I have nothing for lastName and "introduction".



      Also, my EqualTo seems to be out :(.
      Did i make mistake?



      Entity



      <?php

      namespace AppEntity;

      use AppEntityAd;
      use CocurSlugifySlugify;
      use DoctrineORMMapping as ORM;
      use DoctrineCommonCollectionsCollection;
      use DoctrineCommonCollectionsArrayCollection;
      use SymfonyComponentValidatorConstraintsEqualTo;
      use SymfonyComponentValidatorConstraints as Assert;
      use SymfonyComponentSecurityCoreUserUserInterface;
      use SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity;

      /**
      * @ORMEntity(repositoryClass="AppRepositoryUserRepository")
      * @ORMHasLifecycleCallbacks()
      * @UniqueEntity(fields="email", message= "User already exist")
      */
      class User implements UserInterface

      /**
      * @ORMId()
      * @ORMGeneratedValue()
      * @ORMColumn(type="integer")
      */
      private $id;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertNotBlank(message="Champ Obligatoire")
      * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
      * @AssertValid
      * @AssertNotNull
      */
      private $firstName;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertNotBlank(message="Champ Obligatoire")
      * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
      * @AssertValid
      * @AssertNotNull
      */
      private $lastName;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertEmail()
      */
      private $email;

      /**
      * @ORMColumn(type="string", length=255, nullable=true)
      * @AssertUrl(message="Entrez une Url valide !")
      */
      private $picture;

      /**
      * @ORMColumn(type="string", length=255)
      */
      private $hash;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertLength(min=10, minMessage="Au moins 10 lettres mon coco ! ")
      *
      */
      private $introduction;

      /**
      * @AssertEqualTo(propertyPath="hash")
      */
      public $passwordConfirm;



      /**
      * @ORMColumn(type="string", length=255)
      */
      private $slug;

      /**
      * @ORMOneToMany(targetEntity="AppEntityAd", mappedBy="author")
      */
      private $ads;

      /**
      * Permet d'initialiser le slug
      *
      * @ORMPrePersist
      * @ORMPreUpdate
      *
      * @return void
      */

      public function initializeSlug()

      if(empty($this->slug))
      $slugify = new Slugify();
      $this->slug = $slugify->slugify($this->firstName . ' ' . $this->lastName);




      public function __construct()

      $this->ads = new ArrayCollection();


      public function getId(): ?int

      return $this->id;


      public function getFirstName(): ?string

      return $this->firstName;


      public function setFirstName(string $firstName): self

      $this->firstName = $firstName;

      return $this;


      public function getLastName(): ?string

      return $this->lastName;


      public function setLastName(string $lastName): self

      $this->lastName = $lastName;

      return $this;


      public function getEmail(): ?string

      return $this->email;


      public function setEmail(string $email): self

      $this->email = $email;

      return $this;


      public function getPicture(): ?string

      return $this->picture;


      public function setPicture(?string $picture): self

      $this->picture = $picture;

      return $this;


      public function getHash(): ?string

      return $this->hash;


      public function setHash(string $hash): self

      $this->hash = $hash;

      return $this;


      public function getIntroduction(): ?string

      return $this->introduction;


      public function setIntroduction(string $introduction): self

      $this->introduction = $introduction;

      return $this;


      public function getSlug(): ?string

      return $this->slug;


      public function setSlug(string $slug): self

      $this->slug = $slug;

      return $this;


      /**
      * @return Collection


      Form




      <?php

      namespace AppForm;

      use AppEntityUser;
      use SymfonyComponentFormAbstractType;
      use SymfonyComponentFormFormBuilderInterface;
      use SymfonyComponentOptionsResolverOptionsResolver;
      use SymfonyComponentFormExtensionCoreTypeTextType;
      use SymfonyComponentFormExtensionCoreTypeEmailType;
      use SymfonyComponentFormExtensionCoreTypeUrlType;
      use SymfonyComponentFormExtensionCoreTypePasswordType;

      class RegistrationType extends ApplicationType


      public function buildForm(FormBuilderInterface $builder, array $options)

      $builder
      ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
      ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
      ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
      ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
      ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
      ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
      ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

      ;


      public function configureOptions(OptionsResolver $resolver)

      $resolver->setDefaults([
      'data_class' => User::class,
      ]);




      Controller



      <?php

      namespace AppForm;

      use AppEntityUser;
      use SymfonyComponentFormAbstractType;
      use SymfonyComponentFormFormBuilderInterface;
      use SymfonyComponentOptionsResolverOptionsResolver;
      use SymfonyComponentFormExtensionCoreTypeTextType;
      use SymfonyComponentFormExtensionCoreTypeEmailType;
      use SymfonyComponentFormExtensionCoreTypeUrlType;
      use SymfonyComponentFormExtensionCoreTypePasswordType;

      class RegistrationType extends ApplicationType


      public function buildForm(FormBuilderInterface $builder, array $options)

      $builder
      ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
      ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
      ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
      ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
      ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
      ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
      ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

      ;


      public function configureOptions(OptionsResolver $resolver)

      $resolver->setDefaults([
      'data_class' => User::class,
      ]);




      Twig



      % extends 'base.html.twig' %

      % block title % Inscription % endblock %

      % block body %

      <div class="row">
      <div class="col-md-3"></div>
      <div class="col-md-6">
      <div class="bg-dark py-3 px-3">
      <h1>Inscrivez-vous sur notre site !</h1>


      form_start(form)
      form_widget(form)

      <button type="submit" class="btn btn-success"> Confirmez votre inscription</button>
      </div>
      </div>
      </div>
      <br/><br/>

      % endblock %


      thank you for watching :)<3



      I expected to have all my assert message workings.










      share|improve this question
















      I have problems with my asserts, only a few works.



      For example, it's ok with the Assert of "firstName", I have the error message, but I have nothing for lastName and "introduction".



      Also, my EqualTo seems to be out :(.
      Did i make mistake?



      Entity



      <?php

      namespace AppEntity;

      use AppEntityAd;
      use CocurSlugifySlugify;
      use DoctrineORMMapping as ORM;
      use DoctrineCommonCollectionsCollection;
      use DoctrineCommonCollectionsArrayCollection;
      use SymfonyComponentValidatorConstraintsEqualTo;
      use SymfonyComponentValidatorConstraints as Assert;
      use SymfonyComponentSecurityCoreUserUserInterface;
      use SymfonyBridgeDoctrineValidatorConstraintsUniqueEntity;

      /**
      * @ORMEntity(repositoryClass="AppRepositoryUserRepository")
      * @ORMHasLifecycleCallbacks()
      * @UniqueEntity(fields="email", message= "User already exist")
      */
      class User implements UserInterface

      /**
      * @ORMId()
      * @ORMGeneratedValue()
      * @ORMColumn(type="integer")
      */
      private $id;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertNotBlank(message="Champ Obligatoire")
      * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
      * @AssertValid
      * @AssertNotNull
      */
      private $firstName;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertNotBlank(message="Champ Obligatoire")
      * @AssertLength(min = 2, minMessage=" Spice de petit troll ! ")
      * @AssertValid
      * @AssertNotNull
      */
      private $lastName;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertEmail()
      */
      private $email;

      /**
      * @ORMColumn(type="string", length=255, nullable=true)
      * @AssertUrl(message="Entrez une Url valide !")
      */
      private $picture;

      /**
      * @ORMColumn(type="string", length=255)
      */
      private $hash;

      /**
      * @ORMColumn(type="string", length=255)
      * @AssertLength(min=10, minMessage="Au moins 10 lettres mon coco ! ")
      *
      */
      private $introduction;

      /**
      * @AssertEqualTo(propertyPath="hash")
      */
      public $passwordConfirm;



      /**
      * @ORMColumn(type="string", length=255)
      */
      private $slug;

      /**
      * @ORMOneToMany(targetEntity="AppEntityAd", mappedBy="author")
      */
      private $ads;

      /**
      * Permet d'initialiser le slug
      *
      * @ORMPrePersist
      * @ORMPreUpdate
      *
      * @return void
      */

      public function initializeSlug()

      if(empty($this->slug))
      $slugify = new Slugify();
      $this->slug = $slugify->slugify($this->firstName . ' ' . $this->lastName);




      public function __construct()

      $this->ads = new ArrayCollection();


      public function getId(): ?int

      return $this->id;


      public function getFirstName(): ?string

      return $this->firstName;


      public function setFirstName(string $firstName): self

      $this->firstName = $firstName;

      return $this;


      public function getLastName(): ?string

      return $this->lastName;


      public function setLastName(string $lastName): self

      $this->lastName = $lastName;

      return $this;


      public function getEmail(): ?string

      return $this->email;


      public function setEmail(string $email): self

      $this->email = $email;

      return $this;


      public function getPicture(): ?string

      return $this->picture;


      public function setPicture(?string $picture): self

      $this->picture = $picture;

      return $this;


      public function getHash(): ?string

      return $this->hash;


      public function setHash(string $hash): self

      $this->hash = $hash;

      return $this;


      public function getIntroduction(): ?string

      return $this->introduction;


      public function setIntroduction(string $introduction): self

      $this->introduction = $introduction;

      return $this;


      public function getSlug(): ?string

      return $this->slug;


      public function setSlug(string $slug): self

      $this->slug = $slug;

      return $this;


      /**
      * @return Collection


      Form




      <?php

      namespace AppForm;

      use AppEntityUser;
      use SymfonyComponentFormAbstractType;
      use SymfonyComponentFormFormBuilderInterface;
      use SymfonyComponentOptionsResolverOptionsResolver;
      use SymfonyComponentFormExtensionCoreTypeTextType;
      use SymfonyComponentFormExtensionCoreTypeEmailType;
      use SymfonyComponentFormExtensionCoreTypeUrlType;
      use SymfonyComponentFormExtensionCoreTypePasswordType;

      class RegistrationType extends ApplicationType


      public function buildForm(FormBuilderInterface $builder, array $options)

      $builder
      ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
      ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
      ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
      ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
      ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
      ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
      ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

      ;


      public function configureOptions(OptionsResolver $resolver)

      $resolver->setDefaults([
      'data_class' => User::class,
      ]);




      Controller



      <?php

      namespace AppForm;

      use AppEntityUser;
      use SymfonyComponentFormAbstractType;
      use SymfonyComponentFormFormBuilderInterface;
      use SymfonyComponentOptionsResolverOptionsResolver;
      use SymfonyComponentFormExtensionCoreTypeTextType;
      use SymfonyComponentFormExtensionCoreTypeEmailType;
      use SymfonyComponentFormExtensionCoreTypeUrlType;
      use SymfonyComponentFormExtensionCoreTypePasswordType;

      class RegistrationType extends ApplicationType


      public function buildForm(FormBuilderInterface $builder, array $options)

      $builder
      ->add('firstName', TextType::class, $this->getConfiguration("Prénom", "Votre prénom ..."))
      ->add('lastName', TextType::class, $this->getConfiguration("Nom", "Votre Nom ..."))
      ->add('email', EmailType::class, $this->getConfiguration("Email", "Votre adresse email"))
      ->add('picture', UrlType::class, $this->getConfiguration("Photo de profil", "URL de votre avatar ..."))
      ->add('hash', PasswordType::class, $this->getConfiguration("Mot de Passe", "Choisissez un mot de passe ..."))
      ->add('passwordConfirm', PasswordType::class, $this->getConfiguration("Confirmation de mot de passe", "Veuillez confirmer cotre mot de passe"))
      ->add('introduction', TextType::class, $this->getConfiguration("Decription", " Présentez-vous !"))

      ;


      public function configureOptions(OptionsResolver $resolver)

      $resolver->setDefaults([
      'data_class' => User::class,
      ]);




      Twig



      % extends 'base.html.twig' %

      % block title % Inscription % endblock %

      % block body %

      <div class="row">
      <div class="col-md-3"></div>
      <div class="col-md-6">
      <div class="bg-dark py-3 px-3">
      <h1>Inscrivez-vous sur notre site !</h1>


      form_start(form)
      form_widget(form)

      <button type="submit" class="btn btn-success"> Confirmez votre inscription</button>
      </div>
      </div>
      </div>
      <br/><br/>

      % endblock %


      thank you for watching :)<3



      I expected to have all my assert message workings.







      assert symfony-4.2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 25 at 20:55









      Tomka Koliada

      1,2702 gold badges8 silver badges28 bronze badges




      1,2702 gold badges8 silver badges28 bronze badges










      asked Mar 25 at 20:40









      HKHHKH

      14 bronze badges




      14 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346092%2fproblems-with-asserts-symfony-4-2-4%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55346092%2fproblems-with-asserts-symfony-4-2-4%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현