mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 15:13:50 +00:00
fix errors on tests in person bundle
This commit is contained in:
@@ -25,7 +25,7 @@ namespace Chill\PersonBundle\Tests\Controller;
|
||||
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
use Symfony\Component\DomCrawler\Form;
|
||||
use Chill\MainBundle\Test\PrepareClientTrait;
|
||||
use \Symfony\Component\BrowserKit\Client;
|
||||
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
|
||||
|
||||
/**
|
||||
* Test creation and deletion for persons
|
||||
@@ -34,7 +34,7 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
private Client $client;
|
||||
private KernelBrowser $client;
|
||||
|
||||
const FIRSTNAME_INPUT = 'chill_personbundle_person_creation[firstName]';
|
||||
const LASTNAME_INPUT = "chill_personbundle_person_creation[lastName]";
|
||||
@@ -59,8 +59,8 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
string $firstname = 'God',
|
||||
string $lastname = 'Jesus'
|
||||
) {
|
||||
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname);
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname);
|
||||
$creationForm->get(self::FIRSTNAME_INPUT)->setValue($firstname.'_'.uniqid());
|
||||
$creationForm->get(self::LASTNAME_INPUT)->setValue($lastname.'_'.uniqid());
|
||||
$creationForm->get(self::GENDER_INPUT)->select("man");
|
||||
$date = new \DateTime('1947-02-01');
|
||||
$creationForm->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
|
||||
@@ -114,20 +114,6 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Form $form
|
||||
* @depends testAddAPersonPage
|
||||
*/
|
||||
public function testForgedNullGender(Form $form)
|
||||
{
|
||||
$form->get(self::FIRSTNAME_INPUT)->setValue('john');
|
||||
$form->get(self::LASTNAME_INPUT)->setValue('doe');
|
||||
$date = new \DateTime('1947-02-01');
|
||||
$form->get(self::BIRTHDATE_INPUT)->setValue($date->format('d-m-Y'));
|
||||
$this->client->submit($form);
|
||||
$this->assertResponseStatusCodeSame(500);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the creation of a valid person.
|
||||
@@ -140,8 +126,8 @@ class PersonControllerCreateTest extends WebTestCase
|
||||
{
|
||||
$this->fillAValidCreationForm($form);
|
||||
$client = $this->client;
|
||||
$client->submit($form);
|
||||
|
||||
$crawler = $client->submit($form);
|
||||
|
||||
$this->assertTrue((bool)$client->getResponse()->isRedirect(),
|
||||
"a valid form redirect to url /{_locale}/person/{personId}/general/edit");
|
||||
$client->followRedirect();
|
||||
|
Reference in New Issue
Block a user