Upload beautify

This commit is contained in:
2026-02-14 15:14:12 +01:00
parent e129618910
commit 79192345e3
249 changed files with 24436 additions and 1021 deletions

View File

@@ -0,0 +1,56 @@
<?php
use App\Http\Controllers\ContentRouterController;
use App\Models\Artwork;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\Request;
use Illuminate\View\View;
uses(RefreshDatabase::class);
it('handles model-bound artwork parameter without 404 fallback', function () {
$artwork = Artwork::factory()->create([
'slug' => 'bound-model-artwork',
'is_public' => true,
'is_approved' => true,
'published_at' => now()->subMinute(),
]);
$request = Request::create('/photography/abstract/bound-model-artwork', 'GET');
$response = app(ContentRouterController::class)->handle(
$request,
'photography',
'abstract',
$artwork
);
expect($response)->toBeInstanceOf(View::class);
expect($response->name())->toBe('artworks.show');
expect($response->getData()['artwork']->id)->toBe($artwork->id);
});
it('binds routed artwork model and renders published artwork page', function () {
$artwork = Artwork::factory()->create([
'title' => 'Routed Binding Artwork',
'slug' => 'routed-binding-artwork',
'is_public' => true,
'is_approved' => true,
'published_at' => now()->subMinute(),
]);
$url = route('artworks.show', [
'contentTypeSlug' => 'photography',
'categoryPath' => 'abstract',
'artwork' => $artwork->slug,
]);
$matchedRoute = app('router')->getRoutes()->match(Request::create($url, 'GET'));
app('router')->substituteBindings($matchedRoute);
expect($matchedRoute->parameter('artwork'))->toBeInstanceOf(Artwork::class);
expect($matchedRoute->parameter('artwork')->id)->toBe($artwork->id);
$this->get($url)
->assertOk()
->assertSee('Routed Binding Artwork');
});