46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?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);
|
|
});
|