From 2384281532c7ec02716cd0f75d6fa57d970d34fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 7 Jun 2021 21:23:28 +0200 Subject: [PATCH 1/4] update test app to new version --- tests/app | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app b/tests/app index 8e74ea90b..eb7d6397f 160000 --- a/tests/app +++ b/tests/app @@ -1 +1 @@ -Subproject commit 8e74ea90b1376e25f837c582965d1e549e5c485b +Subproject commit eb7d6397f301efc388060c24165db24d349c9402 From 4dc82bc207053dcf9552f5cda4fb25548f6573ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 7 Jun 2021 21:52:17 +0200 Subject: [PATCH 2/4] add test for Member edition + fix path --- .../Controller/HouseholdMemberController.php | 2 +- .../HouseholdMemberControllerTest.php | 47 ++++++++++++++++++- 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php index d8e45471a..ec22b6851 100644 --- a/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php +++ b/src/Bundle/ChillPersonBundle/Controller/HouseholdMemberController.php @@ -62,7 +62,7 @@ class HouseholdMemberController extends ApiController /** * @Route( - * "/api/1.0/person/household/member/{id}/edit", + * "/{_locale}/person/household/member/{id}/edit", * name="chill_person_household_member_edit" * ) */ diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php index 96cb81382..183760241 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/HouseholdMemberControllerTest.php @@ -8,6 +8,7 @@ use Chill\MainBundle\Test\PrepareClientTrait; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Chill\PersonBundle\Entity\Person; use Chill\PersonBundle\Entity\Household\Household; +use Chill\PersonBundle\Entity\Household\HouseholdMember; use Chill\PersonBundle\Entity\Household\Position; use Doctrine\ORM\EntityManagerInterface; @@ -17,7 +18,7 @@ class HouseholdMemberControllerTest extends WebTestCase use PrepareClientTrait; /** - * @dataProvider provideValidData + * @dataProvider provideValidDataMove */ public function testMoveMember($personId, $householdId, $positionId, \DateTimeInterface $date) { @@ -66,7 +67,31 @@ class HouseholdMemberControllerTest extends WebTestCase ); } - public function provideValidData(): \Iterator + /** + * @dataProvider provideValidDataEditMember + */ + public function testEditMember($memberId) + { + $client = $this->getClientAuthenticated(); + + $crawler = $client->request( + Request::METHOD_GET, + "/fr/person/household/member/{$memberId}/edit" + ); + + $this->assertResponseIsSuccessful(); + + $form = $crawler->selectButton('Enregistrer') + ->form(); + $form['household_member[endDate]'] = (new \DateTime('tomorrow')) + ->format('d-m-Y'); + + $crawler = $client->submit($form); + + $this->assertEquals(302, $client->getResponse()->getStatusCode()); + } + + public function provideValidDataMove(): \Iterator { self::bootKernel(); $em = self::$container->get(EntityManagerInterface::class); @@ -95,4 +120,22 @@ class HouseholdMemberControllerTest extends WebTestCase new \DateTimeImmutable('today') ]; } + + public function provideValidDataEditMember(): \Iterator + { + self::bootKernel(); + $em = self::$container->get(EntityManagerInterface::class); + + $membershipIds = $em->createQuery("SELECT m.id FROM ".HouseholdMember::class." m ". + "JOIN m.person p ". + "JOIN p.center c ". + "WHERE c.name = :center AND m.endDate IS NULL") + ->setParameter('center', 'Center A') + ->getScalarResult() + ; + + \shuffle($membershipIds); + + yield [ \array_pop($membershipIds)['id'] ]; + } } From ed891b224f5495bbfc5af1f5bceceddb87c27847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Tue, 8 Jun 2021 12:36:01 +0200 Subject: [PATCH 3/4] allow to distinguish stle for list-with-periods and list household members in css --- .../public/sass/person_with_period.scss | 23 ++++++++++++------- .../views/Household/banner.html.twig | 22 ++++++++++++++---- 2 files changed, 33 insertions(+), 12 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss index 6f52d2cae..dc1c96274 100644 --- a/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss +++ b/src/Bundle/ChillPersonBundle/Resources/public/sass/person_with_period.scss @@ -1,5 +1,7 @@ /// complete and overwrite flex-table in chillmain.scss -div.list-with-period { +div.list-with-period, +div.list-household-members, +div.list-household-members--summary { div.person { ul.record_actions { li { @@ -7,6 +9,9 @@ div.list-with-period { } } } + div.comment { + // for the comment for household-members + } div.periods { div.header, div.list-content { @@ -39,12 +44,14 @@ div.list-with-period { } } } + + .chill-entity__person { + .chill-entity__person__first-name, + .chill-entity__person__last-name { + font-size: 1.3em; + font-weight: 700; + } + } } -.chill-entity__person { - .chill-entity__person__first-name, - .chill-entity__person__last-name { - font-size: 1.3em; - font-weight: 700; - } -} + diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig index 57b89851d..cf12b1c4f 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Household/banner.html.twig @@ -1,4 +1,4 @@ -
+