update
This commit is contained in:
45
tests/Feature/ProfileGalleryPageTest.php
Normal file
45
tests/Feature/ProfileGalleryPageTest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\User;
|
||||
|
||||
it('renders the canonical profile gallery page', function () {
|
||||
$user = User::factory()->create([
|
||||
'username' => 'gregor',
|
||||
]);
|
||||
|
||||
Artwork::factory()->create([
|
||||
'user_id' => $user->id,
|
||||
'title' => 'Gallery Artwork',
|
||||
'is_public' => true,
|
||||
'is_approved' => true,
|
||||
'published_at' => now()->subDay(),
|
||||
]);
|
||||
|
||||
$this->get('/@gregor/gallery')
|
||||
->assertOk()
|
||||
->assertSee('http://skinbase26.test/@gregor/gallery', false)
|
||||
->assertSee('Profile\\/ProfileGallery', false);
|
||||
});
|
||||
|
||||
it('redirects the legacy gallery route to the canonical profile gallery', function () {
|
||||
$user = User::factory()->create([
|
||||
'username' => 'gregor',
|
||||
]);
|
||||
|
||||
$this->get('/gallery/' . $user->id . '/Gregor%20Klev%C5%BEe')
|
||||
->assertRedirect('/@gregor/gallery')
|
||||
->assertStatus(301);
|
||||
});
|
||||
|
||||
it('redirects mixed-case profile gallery usernames to the lowercase canonical route', function () {
|
||||
User::factory()->create([
|
||||
'username' => 'gregor',
|
||||
]);
|
||||
|
||||
$this->get('/@Gregor/gallery')
|
||||
->assertRedirect('/@gregor/gallery')
|
||||
->assertStatus(301);
|
||||
});
|
||||
Reference in New Issue
Block a user