shouldReceive('send')->once()->andReturn(true); $notifier = Mockery::mock(UserNotificationDispatchService::class); $notifier->shouldReceive('notifyUser')->once(); $service = new PaymentEventService($email, $notifier); $result = $service->paymentReceived([ 'user_id' => 1, 'email' => 'parent@example.com', 'firstname' => 'Parent', 'lastname' => 'User', 'amount' => 25, 'invoice_id' => 10, 'payment_date' => now()->toDateTimeString(), 'installment_seq' => 1, 'pre_balance' => 50, 'post_balance' => 25, 'invoice_total' => 100, ]); $this->assertTrue($result['ok']); } public function test_extra_charge_requires_email(): void { $email = Mockery::mock(EmailService::class); $notifier = Mockery::mock(UserNotificationDispatchService::class); $notifier->shouldReceive('notifyUser')->once(); $service = new PaymentEventService($email, $notifier); $result = $service->extraCharge([ 'user_id' => 1, 'firstname' => 'Parent', 'lastname' => 'User', 'amount_signed' => 10, 'amount_abs' => 10, 'pre_balance' => 0, 'post_balance' => 10, 'invoice_total' => 100, 'charge_title' => 'Fee', 'charge_type' => 'add', ]); $this->assertFalse($result['ok']); } }