(string) Str::uuid(), 'name' => 'A', 'email' => 'a+'.uniqid().'@x.com']); } public function test_analytics_page_renders_for_authenticated_user(): void { $this->actingAs($this->user()) ->get(route('qr.analytics.index')) ->assertOk() ->assertSee('Analytics', false) ->assertSee('Total scans', false) ->assertSee('Top codes', false) ->assertSee('Recent scans', false); } public function test_analytics_page_shows_scan_data(): void { $user = $this->user(); $code = QrCode::create([ 'user_id' => $user->id, 'short_code' => 'test-code-'.uniqid(), 'type' => 'url', 'label' => 'Menu QR', 'destination_url' => 'https://example.com', 'scans_total' => 3, 'unique_scans_total' => 2, ]); QrScanEvent::create([ 'qr_code_id' => $code->id, 'scanned_at' => now()->subDay(), 'device_type' => 'mobile', 'browser' => 'Chrome', 'is_unique' => true, ]); $this->actingAs($user) ->get(route('qr.analytics.index')) ->assertOk() ->assertSee('Menu QR', false) ->assertSee('3', false) ->assertSee('Chrome', false); } }