createUser(['ROLE_DOCTOR']); $doctorA = new Doctor($ownerA, 'دکتر A'); $this->em->persist($doctorA); $this->em->flush(); $section = new ServiceSection('doctor', $doctorA->getId(), 'بخش A'); $item = new ServiceItem($section, 'خدمت'); $this->em->persist($section); $this->em->persist($item); // unrelated tenant B's staff $doctorB = new Doctor($this->createUser(['ROLE_DOCTOR']), 'دکتر B'); $this->em->persist($doctorB); $this->em->flush(); $foreignStaff = new ClinicStaff('doctor', $doctorB->getId(), 'پرسنل B'); $this->em->persist($foreignStaff); $this->em->flush(); $this->authJson('PATCH', '/api/v1/service-item/' . $item->getUuid(), $ownerA, [ 'staff_uuid' => $foreignStaff->getUuid(), ]); $this->assertSame(422, $this->responseCode()); } }