mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Merge branch 'tests/fix-tests-after-bootstrap' into 'master'
Fix tests after introduction of bootstrap See merge request Chill-Projet/chill-bundles!111
This commit is contained in:
commit
65198937c0
@ -50,7 +50,7 @@
|
|||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
|
|
||||||
{# Flash messages ! #}
|
{# Flash messages ! #}
|
||||||
{% if app.session.flashbag.all()|length > 0 %}
|
{% if app.session.flashbag.keys()|length > 0 %}
|
||||||
<div class="col-8 mt-5 flash_message">
|
<div class="col-8 mt-5 flash_message">
|
||||||
|
|
||||||
{% for flashMessage in app.session.flashbag.get('success') %}
|
{% for flashMessage in app.session.flashbag.get('success') %}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
|
||||||
{# Flash messages ! #}
|
{# Flash messages ! #}
|
||||||
{% if app.session.flashbag.all()|length > 0 %}
|
{% if app.session.flashbag.keys()|length > 0 %}
|
||||||
<div class="row justify-content-center mt-5">
|
<div class="row justify-content-center mt-5">
|
||||||
|
|
||||||
{% for flashMessage in app.session.flashbag.get('success') %}
|
{% for flashMessage in app.session.flashbag.get('success') %}
|
||||||
|
@ -0,0 +1,6 @@
|
|||||||
|
years_old: >-
|
||||||
|
{age, plural,
|
||||||
|
one {# an}
|
||||||
|
many {# ans}
|
||||||
|
other {# ans}
|
||||||
|
}
|
@ -734,9 +734,13 @@ class Person implements HasCenterInterface, TrackCreationInterface, TrackUpdateI
|
|||||||
return $this->birthdate;
|
return $this->birthdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getAge(): int
|
public function getAge(): ?int
|
||||||
{
|
{
|
||||||
return date_diff($this->birthdate, date_create('now'))->format("%y");
|
if ($this->birthdate instanceof \DateTimeInterface) {
|
||||||
|
return date_diff($this->birthdate, date_create('now'))->format("%y");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,10 +76,10 @@
|
|||||||
{{ 'Unknown date of birth'|trans }}
|
{{ 'Unknown date of birth'|trans }}
|
||||||
{% else %}
|
{% else %}
|
||||||
{{ person.birthdate|format_date('short') }}
|
{{ person.birthdate|format_date('short') }}
|
||||||
|
<span class="age">
|
||||||
|
{{ 'years_old'|trans({ 'age': person.age }) }}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span class="age">
|
|
||||||
{{ person.age ~ ((person.age > 1) ? ' ans' : ' an') }}
|
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{%- if chill_person.fields.nationality == 'visible' -%}
|
{%- if chill_person.fields.nationality == 'visible' -%}
|
||||||
|
@ -152,7 +152,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
* 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
|
||||||
* And the next page should have a `.error` element present in page
|
* And the next page should have a `.alert-danger` element present in page
|
||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
*/
|
*/
|
||||||
@ -174,7 +174,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
'/fr/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('.alert-success')->count(),
|
||||||
"a 'success' element is shown");
|
"a 'success' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +186,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
* 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
|
||||||
* And the next page should have a `.error` element present in page
|
* And the next page should have a `.alert-danger` element present in page
|
||||||
*
|
*
|
||||||
* @todo
|
* @todo
|
||||||
*/
|
*/
|
||||||
@ -207,8 +207,8 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stays on the /close page');
|
'the server stays on the /close page');
|
||||||
$this->assertGreaterThan(0, $crawlerResponse
|
$this->assertGreaterThan(0, $crawlerResponse
|
||||||
->filter('.error')->count(),
|
->filter('.alert-danger')->count(),
|
||||||
"an '.error' element is shown");
|
"an '.alert-danger' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -240,7 +240,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
'/fr/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('.alert-success')->count(),
|
||||||
"a 'success' element is shown");
|
"a 'success' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,7 +275,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawler->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawler->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,7 +351,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawlerResponse->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawlerResponse->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -382,7 +382,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawler->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,7 +424,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawlerResponse->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawlerResponse->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,7 +465,7 @@ class AccompanyingPeriodControllerTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the server stay on form page');
|
'the server stay on form page');
|
||||||
$this->assertGreaterThan(0, $crawlerResponse->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawlerResponse->filter('.alert-danger')->count(),
|
||||||
"an 'error' element is shown");
|
"an 'error' element is shown");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,6 @@ class PersonControllerUpdateTest extends WebTestCase
|
|||||||
public function testHiddenFielsArePresent()
|
public function testHiddenFielsArePresent()
|
||||||
{
|
{
|
||||||
$crawler = $this->client->request('GET', $this->editUrl);
|
$crawler = $this->client->request('GET', $this->editUrl);
|
||||||
|
|
||||||
$configurables = array('placeOfBirth', 'phonenumber', 'email',
|
$configurables = array('placeOfBirth', 'phonenumber', 'email',
|
||||||
'countryOfBirth', 'nationality', 'spokenLanguages', 'maritalStatus');
|
'countryOfBirth', 'nationality', 'spokenLanguages', 'maritalStatus');
|
||||||
$form = $crawler->selectButton('Enregistrer')->form(); //;
|
$form = $crawler->selectButton('Enregistrer')->form(); //;
|
||||||
@ -190,7 +189,7 @@ class PersonControllerUpdateTest extends WebTestCase
|
|||||||
'the value '.$field.' is updated in db');
|
'the value '.$field.' is updated in db');
|
||||||
|
|
||||||
$crawler = $this->client->followRedirect();
|
$crawler = $this->client->followRedirect();
|
||||||
$this->assertGreaterThan(0, $crawler->filter('.success')->count(),
|
$this->assertGreaterThan(0, $crawler->filter('.alert-success')->count(),
|
||||||
'a element .success is shown');
|
'a element .success is shown');
|
||||||
|
|
||||||
if($field == 'birthdate' or $field == 'memo' or $field == 'countryOfBirth' or $field == 'nationality'
|
if($field == 'birthdate' or $field == 'memo' or $field == 'countryOfBirth' or $field == 'nationality'
|
||||||
@ -245,7 +244,7 @@ class PersonControllerUpdateTest extends WebTestCase
|
|||||||
|
|
||||||
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
$this->assertFalse($this->client->getResponse()->isRedirect(),
|
||||||
'the page is not redirected to /general');
|
'the page is not redirected to /general');
|
||||||
$this->assertGreaterThan(0, $crawler->filter('.error')->count(),
|
$this->assertGreaterThan(0, $crawler->filter('.alert-danger')->count(),
|
||||||
'a element .error is shown');
|
'a element .error is shown');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user