createOne(); $response = get(route('dump.show', ['dump' => $dump])); $response->assertForbidden(); }); test('dump downloading permitted for bypass', function (): void { Feature::activate(AllowDumpDownloading::class, fake()->boolean()); $fs = Storage::fake(Config::get(DumpConstants::DISK_QUALIFIED)); $filename = Dump::factory()->makeOne()->path.'.sql'; $file = File::fake()->create($filename); $fsFile = $fs->putFileAs('', $file, $filename); $dump = Dump::factory()->createOne([ Dump::ATTRIBUTE_PATH => $fsFile, ]); $user = User::factory() ->withAdmin() ->withPermissions( CrudPermission::VIEW->format(Dump::class), SpecialPermission::BYPASS_FEATURE_FLAGS->value ) ->createOne(); actingAs($user); $response = get(route('dump.show', ['dump' => $dump])); $response->assertDownload($dump->path); }); test('downloaded through response', function (): void { Feature::activate(AllowDumpDownloading::class); $fs = Storage::fake(Config::get(DumpConstants::DISK_QUALIFIED)); $filename = Dump::factory()->makeOne()->path.'.sql'; $file = File::fake()->create($filename); $fsFile = $fs->putFileAs('', $file, $filename); $dump = Dump::factory()->createOne([ Dump::ATTRIBUTE_PATH => $fsFile, ]); $user = User::factory() ->withAdmin() ->withPermissions( CrudPermission::VIEW->format(Dump::class) ) ->createOne(); actingAs($user); $response = get(route('dump.show', ['dump' => $dump])); $response->assertDownload($dump->path); });