Skip to content
Snippets Groups Projects
Commit e3f1b533 authored by Qiangjun Ran's avatar Qiangjun Ran Committed by Qiangjun Ran
Browse files

Issue #3144158 by jungle: Fix ModuleFunctionsTest involving in StreamWrapperManager

parent 20ece4d4
No related branches found
No related tags found
No related merge requests found
......@@ -5,6 +5,8 @@
* Provides access to various filesystem backends using Flysystem.
*/
use Drupal\Core\StreamWrapper\StreamWrapperManager;
/**
* Implements hook_cron().
*/
......@@ -24,7 +26,7 @@ function flysystem_rebuild() {
*/
function flysystem_file_download($uri) {
$schemes = Drupal::service('flysystem_factory')->getSchemes();
$scheme = Drupal::service('file_system')->uriScheme($uri);
$scheme = StreamWrapperManager::getScheme($uri);
if (!$scheme || !in_array($scheme, $schemes, TRUE)) {
return;
......
......@@ -2,7 +2,7 @@
namespace Drupal\Tests\flysystem\Unit;
use Drupal\Core\File\FileSystemInterface;
use Drupal\Core\StreamWrapper\StreamWrapperManagerInterface;
use Drupal\Tests\UnitTestCase;
use Drupal\flysystem\FlysystemFactory;
use Prophecy\Argument;
......@@ -36,8 +36,8 @@ class ModuleFunctionsTest extends UnitTestCase {
$this->factory = $this->prophesize(FlysystemFactory::class);
$this->factory->getSchemes()->willReturn(['vfs']);
$file_system_helper = $this->prophesize(FileSystemInterface::class);
$file_system_helper->uriScheme(Argument::type('string'))->will(function ($uri) {
$file_system_helper = $this->prophesize(StreamWrapperManagerInterface::class);
$file_system_helper->isValidScheme(Argument::type('string'))->will(function ($uri) {
list($scheme) = explode('://', $uri[0]);
return $scheme;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment