fix tests

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

View File

@@ -148,7 +148,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
* Test the closing of a periods
*
* 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 : the last closing motive in list
* Then the response should redirect to period view
@@ -158,10 +158,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testClosingCurrentPeriod()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$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)
->setValue($this->getLastValueOnClosingMotive($form));
@@ -171,7 +171,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$cr = $this->client->submit($form);
$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');
$this->assertGreaterThan(0, $this->client->followRedirect()
->filter('.success')->count(),
@@ -182,7 +182,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
* Test the closing of a periods
*
* 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 : the last closing motive in list
* Then the response should redirect to period view
@@ -192,10 +192,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testClosingCurrentPeriodWithDateClosingBeforeOpeningFails()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$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)
->setValue($this->getLastValueOnClosingMotive($form));
@@ -223,10 +223,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testAddNewPeriodBeforeActual()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$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)
->setValue($this->getLastValueOnClosingMotive($form));
$form->get(self::CLOSING_INPUT)
@@ -237,7 +237,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
$this->client->submit($form);
$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');
$this->assertGreaterThan(0, $this->client->followRedirect()
->filter('.success')->count(),
@@ -257,10 +257,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testCreatePeriodWithClosingAfterCurrentFails()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$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)
->setValue($this->getLastValueOnClosingMotive($form));
$form->get(self::CLOSING_INPUT)
@@ -289,10 +289,10 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testCreatePeriodWithOpeningAndClosingAfterCurrentFails()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$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)
->setValue($this->getLastValueOnClosingMotive($form));
$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');
$form = $crawler->selectButton('Create an accompanying period')->form();;
@@ -361,7 +361,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
*/
public function testCreatePeriodWithClosingBeforeOpeningFails()
{
$crawler = $this->client->request('GET', '/en/person/'
$crawler = $this->client->request('GET', '/fr/person/'
.$this->person->getId().'/accompanying-period/create');
$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');
$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');
$form = $crawler->selectButton('Create an accompanying period')->form();
@@ -523,4 +523,4 @@ class AccompanyingPeriodControllerTest extends WebTestCase
"Test the response is a redirection => the period is re-opened");
}
}
}