Implement creator studio and upload updates
This commit is contained in:
41
tests/Feature/ArtworkSlugRoutingTest.php
Normal file
41
tests/Feature/ArtworkSlugRoutingTest.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Artwork;
|
||||
use App\Models\User;
|
||||
use App\Services\Artworks\ArtworkDraftService;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
it('allows duplicate artwork slugs when creating drafts', function () {
|
||||
$user = User::factory()->create();
|
||||
$drafts = app(ArtworkDraftService::class);
|
||||
|
||||
$first = $drafts->createDraft($user->id, 'Silent', null);
|
||||
$second = $drafts->createDraft($user->id, 'Silent', null);
|
||||
|
||||
expect(Artwork::query()->findOrFail($first->artworkId)->slug)->toBe('silent')
|
||||
->and(Artwork::query()->findOrFail($second->artworkId)->slug)->toBe('silent');
|
||||
});
|
||||
|
||||
it('resolves public artwork pages by id even when slugs are duplicated', function () {
|
||||
$first = Artwork::factory()->create([
|
||||
'title' => 'Silent',
|
||||
'slug' => 'silent',
|
||||
'description' => 'First silent artwork.',
|
||||
]);
|
||||
|
||||
$second = Artwork::factory()->create([
|
||||
'title' => 'Silent',
|
||||
'slug' => 'silent',
|
||||
'description' => 'Second silent artwork.',
|
||||
]);
|
||||
|
||||
$this->get(route('art.show', ['id' => $first->id, 'slug' => 'silent']))
|
||||
->assertOk()
|
||||
->assertSee('First silent artwork.', false);
|
||||
|
||||
$this->get(route('art.show', ['id' => $second->id, 'slug' => 'silent']))
|
||||
->assertOk()
|
||||
->assertSee('Second silent artwork.', false);
|
||||
});
|
||||
Reference in New Issue
Block a user