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

commented Sep 15, 2019

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?).

sebdesign added 3 commits Sep 15, 2019
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
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.