createUser(['ROLE_DOCTOR']), 'دکتر'); $this->em->persist($doctor); for ($i = 0; $i < 7; $i++) { $this->em->persist((new Comment($this->createUser(), $doctor, "نظر $i"))->approve()); } $this->em->flush(); $this->client->request('GET', '/api/v1/comments/' . $doctor->getUuid() . '?limit=5'); $body = json_decode($this->client->getResponse()->getContent(), true); $this->assertSame(200, $this->responseCode()); $this->assertCount(5, $body['data']['data']); $this->assertSame(7, $body['data']['meta']['totalRecords']); } public function testAdminPendingListPaginates(): void { $doctor = new Doctor($this->createUser(['ROLE_DOCTOR']), 'دکتر'); $this->em->persist($doctor); $admin = $this->createUser(['ROLE_ADMIN']); for ($i = 0; $i < 7; $i++) { // not approved → pending $this->em->persist(new Comment($this->createUser(), $doctor, "در انتظار $i")); } $this->em->flush(); $body = $this->authJson('GET', '/api/v1/admin/comments/pending?limit=5', $admin); $this->assertSame(200, $this->responseCode()); $this->assertCount(5, $body['data']['data']); // pending is global (not per-doctor); db_test may hold others → at least 7 $this->assertGreaterThanOrEqual(7, $body['data']['meta']['totalRecords']); } }