Files
clinicpro/tests/Audit/LowTierFixesTest.php
hamed 773f9d4d16 feat: update session payment logic to ensure accurate payable amounts and reflect consumables in cost breakdown
- Adjusted the calculation of payable amounts in PaymentStep to align with server logic, ensuring overpayments are handled correctly.
- Enhanced DetailsStep to include consumables in the itemized cost breakdown, ensuring consistency with patient share calculations.
- Updated tests for SessionPaymentPage to validate new behavior regarding overpayments and consumable listings.
- Modified PatientController to register SessionPayment correctly when settling sessions via wallet, preventing double charges.
- Refactored WalletService to remove outdated methods and ensure wallet transactions reflect the correct amounts after discounts.
- Improved accessibility in SearchableSelect component by adding aria labels and ensuring proper role attributes for screen readers.
- Updated styles to ensure minimum touch targets meet WCAG guidelines for mobile usability.
2026-07-19 13:29:46 +03:30

45 lines
1.6 KiB
PHP

<?php
namespace App\Tests\Audit;
use App\Auth\Entity\PreRegistration;
use App\Tests\ApiTestCase;
/**
* Low-tier audit fixes:
* L1 — PATCH /session enforces the patient_records subscription gate.
* L11 — POST /pre-registration returns 201 (resource created).
*/
class LowTierFixesTest extends ApiTestCase
{
public function testUpdateSessionEnforcesPatientGate(): void
{
// ROLE_DOCTOR بدون رکورد Doctor → resolveEntity مقدار entityId=null می‌دهد
// و گیت با ERR_FORBIDDEN_001 رد می‌کند. (به features پلن وابسته نیست: پلن
// free از Version20260705070546 به بعد patient_records را می‌دهد.)
$doctorUser = $this->createUser(['ROLE_DOCTOR']);
// gate fires before the session lookup → 403 (not 404)
$this->authJson('PATCH', '/api/v1/session/nonexistent-uuid', $doctorUser, ['notes' => 'x']);
$this->assertSame(403, $this->responseCode());
}
public function testPreRegistrationReturns201(): void
{
$mobile = '0912' . str_pad((string) random_int(0, 9_999_999), 7, '0', STR_PAD_LEFT);
$this->client->request(
'POST',
'/api/v1/pre-registration',
server: ['CONTENT_TYPE' => 'application/json'],
content: json_encode([
'type' => PreRegistration::TYPE_INDEPENDENT_DOCTOR,
'name' => 'علی محمدی',
'mobile' => $mobile,
]),
);
$this->assertSame(201, $this->client->getResponse()->getStatusCode());
}
}