feat: integrate Spatie Media Library (#4)

- Added Spatie Media Library
- Added media library configuration file
- Updated Entry model to support media handling
- Added featured image upload with gallery selection and preview
- Added login tests with Dusk for user authentication
- Added Dusk test for featured image selection

Co-authored-by: jon brookes <marshyon@gmail.com>
Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/4
This commit is contained in:
Jon Brookes 2026-01-06 13:26:55 +01:00
parent 6cf8d5dfd4
commit 56607285bd
38 changed files with 2200 additions and 16 deletions

View file

@ -0,0 +1,60 @@
<?php
namespace Tests\Browser;
use Illuminate\Foundation\Testing\DatabaseTruncation;
use Laravel\Dusk\Browser;
use Tests\Browser\Concerns\AuthenticatesUsers;
use Tests\DuskTestCase;
class LoginTest extends DuskTestCase
{
use DatabaseTruncation;
use AuthenticatesUsers;
public function test_login(): void
{
$user = $this->createTestUser("login-test@example.com");
$this->browse(function (Browser $browser) use ($user) {
$this->loginUser($browser, $user);
$this->assertWithDebugPause($browser, fn($b) =>
$b->assertPathIs('/dashboard'),
1000 // Custom pause time for this test
);
});
}
public function test_invalid_login(): void
{
$user = $this->createTestUser("invalid-email@example.com");
$this->browse(function (Browser $browser) use ($user) {
$this->loginUser($browser, $user);
$this->assertWithDebugPause($browser, fn($b) =>
$b->visit('/admin')
->waitForLocation('/admin')
->assertPathIs('/admin')
->assertSee('FORBIDDEN'),
1000 // Custom pause time for this test
);
});
}
public function test_access_admin_panel(): void
{
$user = $this->createTestUser("login-test@example.com");
$this->browse(function (Browser $browser) use ($user) {
$this->loginUser($browser, $user);
$this->assertWithDebugPause($browser, fn($b) =>
$b->visit('/admin')
->waitForLocation('/admin')
->assertPathIs('/admin')
->assertTitleContains('Dashboard')
->assertDontSee('FORBIDDEN'),
1000 // Custom pause time for this test
);
});
}
}