createUser(['ROLE_USER', 'ROLE_DOCTOR']); $doctor = new Doctor($user, 'دکتر شعبه'); $doctor->setMobileNumber($user->getMobileNumber()); $this->em->persist($doctor); $this->em->flush(); $address = DoctorAddress::forDoctor($doctor); $address->setName($name); $this->em->persist($address); $this->em->flush(); return [$user, $doctor, $address]; } /** @return array{0: User, 1: Clinic, 2: DoctorAddress} */ protected function clinicWithAddress(string $name = 'شعبهٔ کلینیک'): array { $user = $this->createUser(['ROLE_USER', 'ROLE_CLINIC']); $clinic = new Clinic($user); $clinic->setName('کلینیک تست شعبه'); $this->em->persist($clinic); $this->em->flush(); $address = DoctorAddress::forClinic($clinic->getId()); $address->setName($name); $this->em->persist($address); $this->em->flush(); return [$user, $clinic, $address]; } }