diff --git a/src/FilesystemConfig.php b/src/FilesystemConfig.php index d8a2dd7..a7cda8d 100644 --- a/src/FilesystemConfig.php +++ b/src/FilesystemConfig.php @@ -57,6 +57,7 @@ class FilesystemConfig { if (!app()->has('original-filesystem')) { app()->singleton('original-filesystem', fn () => app(FilesystemManager::class)); + app('original-filesystem'); $mock = M::mock(FilesystemManager::class)->makePartial(); app()->instance(FilesystemManager::class, $mock); } @@ -68,6 +69,15 @@ class FilesystemConfig ->andReturnUsing(function () { return app('original-filesystem')->createLocalDriver(['root' => __DIR__ . '/fakes/' . $this->identifier]); }); + $mock->shouldReceive('createSftpDriver')->withArgs(fn ($config) => $this->host === $config['host'] && $this->username === $config['username'] && $this->password === $config['password'] && $this->path === $config['root']) + ->andReturnUsing(function () { + return new class { + public function files(string $path) + { + throw new \Exception('SFTP not supported in tests'); + } + }; + }); return app('original-filesystem')->createLocalDriver(['root' => __DIR__ . '/fakes/' . $this->identifier]); }