Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
flysystem
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
flysystem
Commits
e3f1b533
Commit
e3f1b533
authored
May 31, 2020
by
Qiangjun Ran
Committed by
Qiangjun Ran
May 31, 2020
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3144158
by jungle: Fix ModuleFunctionsTest involving in StreamWrapperManager
parent
20ece4d4
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
flysystem.module
+3
-1
3 additions, 1 deletion
flysystem.module
tests/src/Unit/ModuleFunctionsTest.php
+3
-3
3 additions, 3 deletions
tests/src/Unit/ModuleFunctionsTest.php
with
6 additions
and
4 deletions
flysystem.module
+
3
−
1
View file @
e3f1b533
...
...
@@ -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'
)
->
uri
Scheme
(
$uri
);
$scheme
=
StreamWrapperManager
::
get
Scheme
(
$uri
);
if
(
!
$scheme
||
!
in_array
(
$scheme
,
$schemes
,
TRUE
))
{
return
;
...
...
This diff is collapsed.
Click to expand it.
tests/src/Unit/ModuleFunctionsTest.php
+
3
−
3
View file @
e3f1b533
...
...
@@ -2,7 +2,7 @@
namespace
Drupal\Tests\flysystem\Unit
;
use
Drupal\Core\
File\FileSystem
Interface
;
use
Drupal\Core\
StreamWrapper\StreamWrapperManager
Interface
;
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
(
FileSystem
Interface
::
class
);
$file_system_helper
->
uri
Scheme
(
Argument
::
type
(
'string'
))
->
will
(
function
(
$uri
)
{
$file_system_helper
=
$this
->
prophesize
(
StreamWrapperManager
Interface
::
class
);
$file_system_helper
->
isValid
Scheme
(
Argument
::
type
(
'string'
))
->
will
(
function
(
$uri
)
{
list
(
$scheme
)
=
explode
(
'://'
,
$uri
[
0
]);
return
$scheme
;
});
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment