cms/tests/Feature/AnalyticsTrackerTest.php
Funky Waddle 37ed997989 feat(cms): initialize Laravel project structure and core CMS files
- Added standard Laravel directory structure and configuration.

- Included Svelte and Tailwind configuration for the admin interface.

- Added core PHPUnit and testing scripts.
2026-04-13 12:48:06 -05:00

34 lines
829 B
PHP

<?php
namespace Tests\Feature;
use App\Models\Page;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AnalyticsTrackerTest extends TestCase
{
use RefreshDatabase;
public function test_tracks_page_views(): void
{
// Use a route that exists (the home route '/')
$response = $this->get('/');
$response->assertStatus(200);
$this->assertEquals(1, \App\Models\PageView::count());
$this->assertDatabaseHas('page_views', [
'path' => '/',
]);
}
public function test_does_not_track_admin_views(): void
{
$response = $this->get(env('ADMIN_PATH', 'loom') . '/dashboard');
$this->assertDatabaseMissing('page_views', [
'path' => '/' . env('ADMIN_PATH', 'loom') . '/dashboard',
]);
}
}