From 2ef800c62d1d8cb00c119e6c61d72031c27a667b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sun, 21 Apr 2024 00:39:56 -0500 Subject: [PATCH] CI: Fix request when testing course access - refs BT#21538 --- .../Repository/Node/CourseRepositoryTest.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/tests/CoreBundle/Repository/Node/CourseRepositoryTest.php b/tests/CoreBundle/Repository/Node/CourseRepositoryTest.php index 16408f35c9..ef8fab26a0 100644 --- a/tests/CoreBundle/Repository/Node/CourseRepositoryTest.php +++ b/tests/CoreBundle/Repository/Node/CourseRepositoryTest.php @@ -224,6 +224,7 @@ class CourseRepositoryTest extends AbstractApiTest $this->assertSame(1, $course->getStudentSubscriptions()->count()); $this->assertSame(0, $course->getTeachersSubscriptions()->count()); + $this->getClientWithGuiCredentials('student', 'student'); $client->request('GET', sprintf('/course/%s/home', $course->getId())); $this->assertResponseIsSuccessful(); } @@ -264,10 +265,10 @@ class CourseRepositoryTest extends AbstractApiTest $courseRepo->update($course); $this->assertSame(2, $course->getTeachersSubscriptions()->count()); - $teacher = $this->getUser('teacher'); - - $token = $this->getUserTokenFromUser($teacher); - $this->createClientWithCredentials($token)->request('GET', sprintf('/course/%s/home', $course->getId())); + $this + ->getClientWithGuiCredentials('teacher', 'teacher') + ->request('GET', sprintf('/course/%s/home', $course->getId())) + ; $this->assertResponseIsSuccessful(); } @@ -290,10 +291,10 @@ class CourseRepositoryTest extends AbstractApiTest $this->assertSame(1, $course->getUsers()->count()); - // retrieve the admin - $student = $this->getUser('student'); - $token = $this->getUserTokenFromUser($student); - $this->createClientWithCredentials($token)->request('GET', sprintf('/course/%s/home', $course->getId())); + $this + ->getClientWithGuiCredentials('student', 'student') + ->request('GET', sprintf('/course/%s/home', $course->getId())) + ; $this->assertResponseIsSuccessful(); }