fix tests

This commit is contained in:
Julien Fastré 2021-05-26 22:57:00 +02:00
parent f3427d6754
commit b88765c344
2 changed files with 20 additions and 22 deletions

View File

@ -18,7 +18,6 @@
<testsuite name="MainBundle"> <testsuite name="MainBundle">
<directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory> <directory suffix="Test.php">src/Bundle/ChillMainBundle/Tests/</directory>
</testsuite> </testsuite>
<!-- remove tests for person temporarily
<testsuite name="PersonBundle"> <testsuite name="PersonBundle">
<directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory> <directory suffix="Test.php">src/Bundle/ChillPersonBundle/Tests/</directory>
<!-- test for export will be runned later --> <!-- test for export will be runned later -->
@ -30,7 +29,6 @@
<!-- find a solution to create multiple configs --> <!-- find a solution to create multiple configs -->
<exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php</exclude> <exclude>src/Bundle/ChillPersonBundle/Tests/Controller/PersonControllerUpdateWithHiddenFieldsTest.php</exclude>
</testsuite> </testsuite>
-->
</testsuites> </testsuites>
<listeners> <listeners>

View File

@ -148,7 +148,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
* Test the closing of a periods * Test the closing of a periods
* *
* Given that a person as an accompanying period opened since 2015-01-05 * Given that a person as an accompanying period opened since 2015-01-05
* and we fill the close form (at /en/person/[id]/accompanying-period/close * and we fill the close form (at /fr/person/[id]/accompanying-period/close
* with : dateClosing: 2015-02-01 * with : dateClosing: 2015-02-01
* with : the last closing motive in list * with : the last closing motive in list
* Then the response should redirect to period view * Then the response should redirect to period view
@ -158,10 +158,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testClosingCurrentPeriod() public function testClosingCurrentPeriod()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/close'); .$this->person->getId().'/accompanying-period/close');
$form = $crawler->selectButton('Close accompanying period')->form(); $form = $crawler->selectButton('Clôre la période')->form();
$form->get(self::CLOSING_MOTIVE_INPUT) $form->get(self::CLOSING_MOTIVE_INPUT)
->setValue($this->getLastValueOnClosingMotive($form)); ->setValue($this->getLastValueOnClosingMotive($form));
@ -171,7 +171,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$cr = $this->client->submit($form); $cr = $this->client->submit($form);
$this->assertTrue($this->client->getResponse()->isRedirect( $this->assertTrue($this->client->getResponse()->isRedirect(
'/en/person/'.$this->person->getId().'/accompanying-period'), '/fr/person/'.$this->person->getId().'/accompanying-period'),
'the server redirects to /accompanying-period page'); 'the server redirects to /accompanying-period page');
$this->assertGreaterThan(0, $this->client->followRedirect() $this->assertGreaterThan(0, $this->client->followRedirect()
->filter('.success')->count(), ->filter('.success')->count(),
@ -182,7 +182,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
* Test the closing of a periods * Test the closing of a periods
* *
* Given that a person as an accompanying period opened since 2015-01-05 * Given that a person as an accompanying period opened since 2015-01-05
* and we fill the close form (at /en/person/[id]/accompanying-period/close * and we fill the close form (at /fr/person/[id]/accompanying-period/close
* with : dateClosing: 2014-01-01 * with : dateClosing: 2014-01-01
* with : the last closing motive in list * with : the last closing motive in list
* Then the response should redirect to period view * Then the response should redirect to period view
@ -192,10 +192,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testClosingCurrentPeriodWithDateClosingBeforeOpeningFails() public function testClosingCurrentPeriodWithDateClosingBeforeOpeningFails()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/close'); .$this->person->getId().'/accompanying-period/close');
$form = $crawler->selectButton('Close accompanying period')->form(); $form = $crawler->selectButton('Clôre la période')->form();
$form->get(self::CLOSING_MOTIVE_INPUT) $form->get(self::CLOSING_MOTIVE_INPUT)
->setValue($this->getLastValueOnClosingMotive($form)); ->setValue($this->getLastValueOnClosingMotive($form));
@ -223,10 +223,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testAddNewPeriodBeforeActual() public function testAddNewPeriodBeforeActual()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton('Créer une période d\'accompagnement')->form();
$form->get(self::CLOSING_MOTIVE_INPUT) $form->get(self::CLOSING_MOTIVE_INPUT)
->setValue($this->getLastValueOnClosingMotive($form)); ->setValue($this->getLastValueOnClosingMotive($form));
$form->get(self::CLOSING_INPUT) $form->get(self::CLOSING_INPUT)
@ -237,7 +237,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->client->submit($form); $this->client->submit($form);
$this->assertTrue($this->client->getResponse()->isRedirect( $this->assertTrue($this->client->getResponse()->isRedirect(
'/en/person/'.$this->person->getId().'/accompanying-period'), '/fr/person/'.$this->person->getId().'/accompanying-period'),
'the server redirects to /accompanying-period page'); 'the server redirects to /accompanying-period page');
$this->assertGreaterThan(0, $this->client->followRedirect() $this->assertGreaterThan(0, $this->client->followRedirect()
->filter('.success')->count(), ->filter('.success')->count(),
@ -257,10 +257,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testCreatePeriodWithClosingAfterCurrentFails() public function testCreatePeriodWithClosingAfterCurrentFails()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton("Créer une période d'accompagnement")->form();
$form->get(self::CLOSING_MOTIVE_INPUT) $form->get(self::CLOSING_MOTIVE_INPUT)
->setValue($this->getLastValueOnClosingMotive($form)); ->setValue($this->getLastValueOnClosingMotive($form));
$form->get(self::CLOSING_INPUT) $form->get(self::CLOSING_INPUT)
@ -289,10 +289,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails() public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton("Créer une période d'accompagnement")->form();
$form->get(self::CLOSING_MOTIVE_INPUT) $form->get(self::CLOSING_MOTIVE_INPUT)
->setValue($this->getLastValueOnClosingMotive($form)); ->setValue($this->getLastValueOnClosingMotive($form));
$form->get(self::CLOSING_INPUT) $form->get(self::CLOSING_INPUT)
@ -330,7 +330,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
] ]
)); ));
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form();; $form = $crawler->selectButton('Create an accompanying period')->form();;
@ -361,7 +361,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/ */
public function testCreatePeriodWithClosingBeforeOpeningFails() public function testCreatePeriodWithClosingBeforeOpeningFails()
{ {
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton('Create an accompanying period')->form();
@ -403,7 +403,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
] ]
)); ));
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton('Create an accompanying period')->form();
@ -444,7 +444,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
] ]
)); ));
$crawler = $this->client->request('GET', '/en/person/' $crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create'); .$this->person->getId().'/accompanying-period/create');
$form = $crawler->selectButton('Create an accompanying period')->form(); $form = $crawler->selectButton('Create an accompanying period')->form();