update manual pay recording
Tests / PHPUnit (push) Successful in 1m17s

This commit is contained in:
root
2026-07-18 15:06:52 -04:00
parent d34dbd2a47
commit 4aac9472af
3 changed files with 76 additions and 2 deletions
@@ -94,6 +94,13 @@ class TestablePaymentController extends PaymentController
class PaymentControllerRegressionTest extends CIUnitTestCase
{
protected function tearDown(): void
{
session()->remove('user_id');
parent::tearDown();
}
public function testRedirectPageSendsUsersBackToInvoicePaymentWithInfoMessage(): void
{
$controller = new TestablePaymentController();
@@ -134,5 +141,27 @@ class PaymentControllerRegressionTest extends CIUnitTestCase
$this->assertSame('proofs/check-123.pdf', $model->inserted[0]['proof_path']);
$this->assertSame('INV-001', $model->inserted[0]['invoice_number']);
}
public function testManualPostStoresLoggedInUserIdAsUpdateBy(): void
{
session()->set('user_id', 42);
$model = new ManualPaymentModelSpy();
$controller = (new TestablePaymentController())
->setManualPaymentModel($model)
->setAttachmentService(new AttachmentServiceStub())
->setRequestObject(new PaymentRequestStub('post', [
'invoice_number' => 'INV-002',
'amount' => '75.00',
'payment_method' => 'cash',
'reference' => 'CASH-42',
]));
$response = $controller->manual();
$this->assertInstanceOf(RedirectResponse::class, $response);
$this->assertCount(1, $model->inserted);
$this->assertSame(42, $model->inserted[0]['update_by']);
}
}
}