createUser($roles); $this->authJson('GET', '/api/v1/service-items', $user); $this->assertSame( 403, $this->responseCode(), sprintf('roles %s should be forbidden, not a server error', implode(',', $roles)), ); } } public function testDoctorStillGetsTheirOwnItems(): void { $owner = $this->createUser(['ROLE_DOCTOR']); $doctor = new Doctor($owner, 'دکتر تست محیط'); $this->em->persist($doctor); $this->em->flush(); $section = new ServiceSection('doctor', $doctor->getId(), 'تزریقات'); $item = new ServiceItem($section, 'سرم ۵۰۰cc'); $this->em->persist($section); $this->em->persist($item); $this->em->flush(); $body = $this->authJson('GET', '/api/v1/service-items', $owner); $this->assertSame(200, $this->responseCode()); $this->assertTrue($body['success']); $this->assertContains('سرم ۵۰۰cc', array_column($body['data'], 'name')); } }