Skip to content

Commit

Permalink
[6.x] Fix FilesystemManager unwanted changes (#30369)
Browse files Browse the repository at this point in the history
* Update expected exception and target disk in test

* Fix filesystem disk resolving
  • Loading branch information
netpok authored and taylorotwell committed Oct 21, 2019
1 parent 204140f commit 0087f11
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ protected function resolve($name)
{
$config = $this->getConfig($name);

$name = $config['driver'] ?? $name;
if (empty($config['driver'])) {
throw new InvalidArgumentException("Disk [{$name}] does not have a configured driver.");
}

$name = $config['driver'];

if (isset($this->customCreators[$name])) {
return $this->callCustomCreator($config);
Expand Down
6 changes: 3 additions & 3 deletions tests/Filesystem/FilesystemManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ class FilesystemManagerTest extends TestCase
public function testExceptionThrownOnUnsupportedDriver()
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Driver [unsupported-disk] is not supported.');
$this->expectExceptionMessage('Disk [local] does not have a configured driver.');

$filesystem = new FilesystemManager(tap(new Application, function ($app) {
$app['config'] = ['filesystems.disks.unsupported-disk' => null];
$app['config'] = ['filesystems.disks.local' => null];
}));

$filesystem->disk('unsupported-disk');
$filesystem->disk('local');
}
}

0 comments on commit 0087f11

Please sign in to comment.