From 8c635c24aff03fd6821ccc2894dd8779111265c5 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Fri, 23 Jul 2021 12:11:58 +0200 Subject: [PATCH] Fix test error when no periods --- .../Tests/Controller/AccompanyingCourseApiControllerTest.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php index 3f427e811..6547b7280 100644 --- a/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php +++ b/src/Bundle/ChillPersonBundle/Tests/Controller/AccompanyingCourseApiControllerTest.php @@ -529,8 +529,9 @@ class AccompanyingCourseApiControllerTest extends WebTestCase ->find($id); $periods = $person->getAccompanyingPeriods(); - yield [$periods[\array_rand($periods)], $socialIssues[\array_rand($socialIssues)] ]; - + if(sizeof($periods) > 0) { + yield [$periods[\array_rand($periods)], $socialIssues[\array_rand($socialIssues)] ]; + } $nbGenerated++; } }