getFile('pdf.pdf', $filename ?: 'pdf.pdf'); } protected function jpgFile(?string $filename = null): File { return $this->getFile('jpg.jpg', $filename ?: 'jpg.jpg'); } protected function pngFile(?string $filename = null): File { return $this->getFile('png.png', $filename ?: 'png.png'); } protected function getFile(string $location, string $as): File { $path = __DIR__ . '/stubs/' . $location; $to = sys_get_temp_dir() . '/' . $as; copy($path, $to); return new File($to); } protected function registerModel(): static { app()->extend('media-library-helpers', fn ($p) => $p->put('post', Post::class)); return $this; } protected function newPost(): Post { return Post::create(['title' => 'Lorem', 'content' => 'aafff']); } protected function auth(array $policies = []): self { $this->be(User::factory()->policies($policies)->create()); return $this; } }