Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.x] Create storage fakes with custom configuration #29999

Merged
merged 3 commits into from
Sep 16, 2019

Conversation

sebdesign
Copy link
Contributor

Currently when a storage disk is faked, we are creating a local disk with the default configuration.

If the developers want to use a custom configuration or reuse the configuration they have in their filesystems.php file, there is no easy way to achieve this.

This commit allows us to pass optional configuration as a second parameter:

Storage::fake('documents', ['visibility' => 'private']);

This change is totally backwars-compatible, but in the future it would be convenient to fetch the actual configuration of the given disk (maybe in Laravel 7.x?).

Currently when a storage disk is faked, we are creating a local disk with the default configuration.

If the developers want to use a custom configuration or reuse the configuration they have in their `filesystems.php` file, there is no easy way to achieve this.

This commit allows us to pass optional configuration as a second parameter:

```php
Storage::fake('documents', ['visibility' => 'private']);
```

This change is totally backwars-compatible, but in the future it would be convenient to fetch the actual configuration of the given disk (maybe in Laravel 7.x?).
All the facades in the framework are using the `static` keyword instead of `self`, so the Storage facade should behave the same way.
@GrahamCampbell GrahamCampbell changed the title Create storage fakes with custom configuration [6.x] Create storage fakes with custom configuration Sep 15, 2019
@taylorotwell taylorotwell merged commit 5587e6b into laravel:6.x Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants