Add JSON files for security audit and test data

- Created a JSON file for the security audit report dated 2026-07-19, detailing various security findings and their relationships.
- Added a JSON file for seed test data, including user creation logic and dependencies in the `seed_testdata.php` file.
- Introduced a JSON file for the AdminCspSubscriberTest, outlining test cases and their structure in the `AdminCspSubscriberTest.php`.
This commit is contained in:
hamed
2026-07-23 15:12:37 +03:30
parent 9a776be13c
commit 0edaf6518f
17 changed files with 2085 additions and 1687 deletions
+37 -2
View File
@@ -7,8 +7,8 @@ use App\Tests\ApiTestCase;
use App\UserProfile\Entity\UserProfile;
/**
* GET /api/v1/my/appointment/patient-lookup — mobile-first patient search used
* by the booking form before asking for national code / name.
* GET /api/v1/my/appointment/patient-lookup — patient search by mobile OR
* national code, used by the booking form before asking for national code / name.
*/
class PatientLookupTest extends ApiTestCase
{
@@ -75,6 +75,41 @@ class PatientLookupTest extends ApiTestCase
self::assertSame(422, $this->responseCode());
}
public function testFoundByNationalCode(): void
{
$mobile = $this->mobile();
$nc = $this->nationalCode();
$patient = $this->createUser(['ROLE_USER'], $mobile);
$patient->setRealName('کدملی جو');
$profile = new UserProfile($patient);
$profile->setNationalCode($nc);
$this->em->persist($profile);
$this->em->flush();
$res = $this->authJson('GET', '/api/v1/my/appointment/patient-lookup?national_code=' . $nc, $this->booker());
self::assertSame(200, $this->responseCode());
self::assertTrue($res['data']['found']);
self::assertSame('کدملی جو', $res['data']['name']);
self::assertSame($mobile, $res['data']['mobile']);
self::assertSame($nc, $res['data']['national_code']);
}
public function testNationalCodeNotFound(): void
{
$res = $this->authJson('GET', '/api/v1/my/appointment/patient-lookup?national_code=' . $this->nationalCode(), $this->booker());
self::assertSame(200, $this->responseCode());
self::assertFalse($res['data']['found']);
}
public function testInvalidNationalCodeIs422(): void
{
$this->authJson('GET', '/api/v1/my/appointment/patient-lookup?national_code=123', $this->booker());
self::assertSame(422, $this->responseCode());
}
public function testPlainUserIsForbidden(): void
{
$this->authJson('GET', '/api/v1/my/appointment/patient-lookup?mobile=' . $this->mobile(), $this->createUser(['ROLE_USER']));