put($path, 'fake-image'); try { $response = app(MediaController::class)->show($path); $this->assertSame(200, $response->getStatusCode()); $this->assertSame('fake-image', file_get_contents($response->getFile()->getPathname())); } finally { Storage::disk('public')->delete($path); } } public function test_media_route_is_registered(): void { $route = app('router')->getRoutes()->getByName('media.show'); $this->assertNotNull($route); $this->assertSame('media/{path}', $route->uri()); } }