Files
Nyan Lin Paing 60413bdebf Phase 7 dashboard widgets, Gitea CI, and branded landing page (T7.1)
- BookingsTodayWidget, RecentBookingsTableWidget (Booking module) and
  RevenueChartWidget, PaymentFailureRateWidget (Payment module) dashboard
  widgets, auto-registered via each plugin's existing discoverWidgets().
- .gitea/workflows/tests.yml: Postgres-backed Pest run on push/PR.
- Landing page (resources/views/welcome.blade.php) now shows the Famous
  Linnyone4 EV logo with a single admin login link, and the Filament admin
  panel uses the same logo as its brand logo.
2026-08-10 00:15:19 +07:00

20 lines
887 B
PHP

<?php
use Modules\Payment\Filament\Widgets\RevenueChartWidget;
use Modules\Payment\Models\Payment;
test('it sums completed payment amounts per day over the last 30 days', function () {
Payment::factory()->completed()->create(['amount' => 10000, 'completed_at' => today()]);
Payment::factory()->completed()->create(['amount' => 5000, 'completed_at' => today()]);
Payment::factory()->create(['amount' => 99999, 'completed_at' => null]); // pending, excluded
Payment::factory()->completed()->create(['amount' => 77777, 'completed_at' => today()->subDays(40)]); // outside window
$widget = new RevenueChartWidget;
$getData = (new ReflectionMethod($widget, 'getData'));
$getData->setAccessible(true);
$data = $getData->invoke($widget);
expect($data['labels'])->toHaveCount(30)
->and(array_sum($data['datasets'][0]['data']))->toBe(15000.0);
});