60413bdebf
- 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.
23 lines
959 B
PHP
23 lines
959 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Livewire\Livewire;
|
|
use Modules\Payment\Filament\Widgets\PaymentFailureRateWidget;
|
|
use Modules\Payment\Models\Payment;
|
|
|
|
test('it computes the failure rate among resolved payments in the last 30 days', function () {
|
|
$this->actingAs(User::factory()->create());
|
|
|
|
Payment::factory()->completed()->create(['initiated_at' => today()]);
|
|
Payment::factory()->completed()->create(['initiated_at' => today()]);
|
|
Payment::factory()->completed()->create(['initiated_at' => today()]);
|
|
Payment::factory()->failed()->create(['initiated_at' => today()]);
|
|
Payment::factory()->create(['initiated_at' => today()]); // pending, excluded from resolved total
|
|
Payment::factory()->failed()->create(['initiated_at' => today()->subDays(40)]); // outside window
|
|
|
|
Livewire::test(PaymentFailureRateWidget::class)
|
|
->assertOk()
|
|
->assertSee('25%')
|
|
->assertSee('1 failed of 4 resolved (last 30 days)');
|
|
});
|