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'); });