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

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript