Add policy, intake, and payment history to the admin student detail view
CI / Coding Standards (pull_request) Successful in 2m47s
CI / PHPStan (pull_request) Successful in 2m56s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m39s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.2) (pull_request) Successful in 43s
CI / Tests (PHP 8.1) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 2s
CI / Coding Standards (pull_request) Successful in 2m47s
CI / PHPStan (pull_request) Successful in 2m56s
CI / Tests (PHP 8.3) (pull_request) Successful in 2m39s
CI / Build Plugin Zip (pull_request) Skipped
CI / Tests (PHP 8.2) (pull_request) Successful in 43s
CI / Tests (PHP 8.1) (pull_request) Successful in 44s
CI / No Debug Code (pull_request) Successful in 2s
The student-administration spec deferred three detail-view sections until Payments landed. Adds them now: policy-acceptance history (title, version, context, date), intake answers (label, answer, context), and — gated on manage_billing — payment history with HST breakdown and receipt numbers. New Auth\StudentHistory builds the display rows from per-student queries added to AcceptanceRepository, AnswerRepository, and PaymentRepository; the Payment model now carries created_at so unpaid rows still have a date. Closes #69 Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
@@ -158,6 +158,22 @@ class PaymentRepositoryTest extends TestCase
|
||||
self::assertCount(1, $this->repo->findPending());
|
||||
}
|
||||
|
||||
public function testFindByStudentPreparesQueryAndMaps(): void
|
||||
{
|
||||
$this->db->shouldReceive('prepare')
|
||||
->once()
|
||||
->with(Mockery::pattern('/student_id = %d ORDER BY created_at DESC, id DESC/'), 'wp_us_payments', 5)
|
||||
->andReturn('SELECT ...');
|
||||
|
||||
$this->db->shouldReceive('get_results')->andReturn([$this->row()]);
|
||||
|
||||
$payments = $this->repo->findByStudent(5);
|
||||
|
||||
self::assertCount(1, $payments);
|
||||
self::assertSame(5, $payments[0]->studentId);
|
||||
self::assertSame('2026-06-08 09:00:00', $payments[0]->createdAt);
|
||||
}
|
||||
|
||||
private function row(): object
|
||||
{
|
||||
return (object) [
|
||||
@@ -177,6 +193,7 @@ class PaymentRepositoryTest extends TestCase
|
||||
'receipt_number' => null,
|
||||
'receipt_sent_at' => null,
|
||||
'paid_at' => null,
|
||||
'created_at' => '2026-06-08 09:00:00',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,6 +46,7 @@ class PaymentTest extends TestCase
|
||||
'receipt_number' => 'USC-7',
|
||||
'receipt_sent_at' => null,
|
||||
'paid_at' => '2026-06-08 10:00:00',
|
||||
'created_at' => '2026-06-08 09:00:00',
|
||||
]);
|
||||
|
||||
self::assertSame(7, $payment->id);
|
||||
@@ -55,6 +56,7 @@ class PaymentTest extends TestCase
|
||||
self::assertSame(Payment::METHOD_COMP, $payment->method);
|
||||
self::assertTrue($payment->isPaid());
|
||||
self::assertSame('USC-7', $payment->receiptNumber);
|
||||
self::assertSame('2026-06-08 09:00:00', $payment->createdAt);
|
||||
}
|
||||
|
||||
public function testTotalAddsTaxToAmount(): void
|
||||
|
||||
Reference in New Issue
Block a user