Skip to content

Instantly share code, notes, and snippets.

@richartkeil
Last active May 31, 2020 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richartkeil/ea3e257df176fabda8cda31d88bfadb0 to your computer and use it in GitHub Desktop.
Save richartkeil/ea3e257df176fabda8cda31d88bfadb0 to your computer and use it in GitHub Desktop.
Laravel Storage and Parallel Testing - Storage Facade
<?php
// ...
public static function fake($disk = null, array $config = []) {
$disk = $disk ?: static::$app['config']->get('filesystems.default');
(new Filesystem)->cleanDirectory(
$root = storage_path('framework/testing/disks/'.$disk)
);
static::set($disk, $fake = static::createLocalDriver(array_merge($config, [
'root' => $root,
])));
return $fake;
}
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment