Merge branch '20-use-fqdn-in-person-creation-form' into 'master'

Use FQDN in PersonCreation form

See merge request Chill-Projet/chill-bundles!52
This commit is contained in:
Julien Fastré 2021-05-18 14:06:57 +00:00
commit c5b0d6e2bd
3 changed files with 15 additions and 10 deletions

View File

@ -300,7 +300,6 @@ final class PersonController extends AbstractController
} }
$form = $this->createForm( $form = $this->createForm(
//CreationPersonType::NAME,
CreationPersonType::class, CreationPersonType::class,
new Person(), new Person(),
array( array(
@ -327,7 +326,7 @@ final class PersonController extends AbstractController
} }
$form = $this->createForm( $form = $this->createForm(
CreationPersonType::NAME, CreationPersonType::class,
$person, $person,
array( array(
'action' => $this->generateUrl('chill_person_review'), 'action' => $this->generateUrl('chill_person_review'),

View File

@ -33,9 +33,10 @@ use Chill\MainBundle\Form\Type\DataTransformer\CenterTransformer;
use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper;
use Chill\PersonBundle\Form\Type\PersonAltNameType; use Chill\PersonBundle\Form\Type\PersonAltNameType;
class CreationPersonType extends AbstractType final class CreationPersonType extends AbstractType
{ {
// TODO: This is only used in test.
// TODO: See if this is still valid and update accordingly.
const NAME = 'chill_personbundle_person_creation'; const NAME = 'chill_personbundle_person_creation';
const FORM_NOT_REVIEWED = 'not_reviewed'; const FORM_NOT_REVIEWED = 'not_reviewed';

View File

@ -25,6 +25,7 @@ namespace Chill\PersonBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\DomCrawler\Form; use Symfony\Component\DomCrawler\Form;
use Chill\MainBundle\Test\PrepareClientTrait; use Chill\MainBundle\Test\PrepareClientTrait;
use \Symfony\Component\BrowserKit\Client;
/** /**
* Test creation and deletion for persons * Test creation and deletion for persons
@ -32,7 +33,9 @@ use Chill\MainBundle\Test\PrepareClientTrait;
class PersonControllerCreateTest extends WebTestCase class PersonControllerCreateTest extends WebTestCase
{ {
use PrepareClientTrait; use PrepareClientTrait;
private Client $client;
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]'; const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]"; const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]";
const GENDER_INPUT = "chill_personbundle_person_creation[gender]"; const GENDER_INPUT = "chill_personbundle_person_creation[gender]";
@ -42,18 +45,20 @@ class PersonControllerCreateTest extends WebTestCase
const LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta.Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq."; const LONG_TEXT = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta. Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi. Nulla quis sem at nibh elementum imperdiet. Duis sagittis ipsum. Praesent mauris. Fusce nec tellus sed augue semper porta.Mauris massa. Vestibulum lacinia arcu eget nulla. Class aptent taciti sociosq.";
public function setUp() public function setUp(): void
{ {
$this->client = $this::getClientAuthenticated(); $this->client = $this->getClientAuthenticated();
} }
/** /**
* *
* @param Form $creationForm * @param Form $creationForm
*/ */
private function fillAValidCreationForm(Form &$creationForm, private function fillAValidCreationForm(
$firstname = 'God', $lastname = 'Jesus') Form &$creationForm,
{ string $firstname = 'God',
string $lastname = 'Jesus'
) {
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname); $creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname);
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname); $creationForm->get(self::LASTNAME_INPUT)->setValue($lastname);
$creationForm->get(self::GENDER_INPUT)->select("man"); $creationForm->get(self::GENDER_INPUT)->select("man");