From acacef936c22a9cb8d28625782e0be81812f3e22 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Thu, 2 Dec 2021 12:49:33 +0100 Subject: [PATCH] changelog updated and stylefix --- CHANGELOG.md | 1 + .../AccompanyingPeriodConfidentialTest.php | 33 ++++++++++--------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f22e6dd9..7d7be3d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to * add an endpoint for checking permissions. See https://gitlab.com/Chill-Projet/chill-bundles/-/merge_requests/232 * [activity] for a new activity: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties * [calendar] for a new rdv: suggest and create on-the-fly locations based on the accompanying course location + location of the suggested parties +* [period] Validation added when period is confidential and confirmed -> user cannot be null. ## Test releases diff --git a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php index 316181814..86759d9fc 100644 --- a/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/AccompanyingPeriod/AccompanyingPeriodConfidentialTest.php @@ -14,10 +14,12 @@ use Chill\PersonBundle\Entity\AccompanyingPeriod; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Symfony\Component\Validator\Validator\ValidatorInterface; - +/** + * @internal + * @coversNothing + */ class AccompanyingPeriodConfidentialTest extends KernelTestCase { - protected static $validator; public static function setUpBeforeClass() @@ -27,22 +29,9 @@ class AccompanyingPeriodConfidentialTest extends KernelTestCase self::$validator = self::$container->get(ValidatorInterface::class); } - public function testConfidentialValid() - { - $period = new AccompanyingPeriod; - $period->setConfidential(true); - $period->setStep('CONFIRMED'); - $period->setUser(new User()); - - - $violations = self::$validator->validate($period, []); - - $this->assertCount(0, $violations); - } - public function testConfidentialInvalid() { - $period = new AccompanyingPeriod; + $period = new AccompanyingPeriod(); $period->setConfidential(true); $period->setStep('CONFIRMED'); @@ -50,4 +39,16 @@ class AccompanyingPeriodConfidentialTest extends KernelTestCase $this->assertCount(1, $violations); } + + public function testConfidentialValid() + { + $period = new AccompanyingPeriod(); + $period->setConfidential(true); + $period->setStep('CONFIRMED'); + $period->setUser(new User()); + + $violations = self::$validator->validate($period, []); + + $this->assertCount(0, $violations); + } }