Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
10b2d649
Commit
10b2d649
authored
11 years ago
by
Jörn Friedrich Dreyer
Committed by
Thomas Müller
11 years ago
Browse files
Options
Downloads
Patches
Plain Diff
extend unit test to directories starting or ending in whitespace
parent
ea4dfa7e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/files/storage/storage.php
+26
-15
26 additions, 15 deletions
tests/lib/files/storage/storage.php
with
26 additions
and
15 deletions
tests/lib/files/storage/storage.php
+
26
−
15
View file @
10b2d649
...
...
@@ -42,18 +42,21 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this
->
assertTrue
(
$this
->
instance
->
isUpdatable
(
'/'
),
'Root folder is not writable'
);
}
public
function
testDirectories
()
{
$this
->
assertFalse
(
$this
->
instance
->
file_exists
(
'/folder'
));
/**
* @dataProvider directoryProvider
*/
public
function
testDirectories
(
$directory
)
{
$this
->
assertFalse
(
$this
->
instance
->
file_exists
(
'/'
.
$directory
));
$this
->
assertTrue
(
$this
->
instance
->
mkdir
(
'/
folder'
));
$this
->
assertTrue
(
$this
->
instance
->
mkdir
(
'/
'
.
$directory
));
$this
->
assertTrue
(
$this
->
instance
->
file_exists
(
'/
folder'
));
$this
->
assertTrue
(
$this
->
instance
->
is_dir
(
'/
folder'
));
$this
->
assertFalse
(
$this
->
instance
->
is_file
(
'/
folder'
));
$this
->
assertEquals
(
'dir'
,
$this
->
instance
->
filetype
(
'/
folder'
));
$this
->
assertEquals
(
0
,
$this
->
instance
->
filesize
(
'/
folder'
));
$this
->
assertTrue
(
$this
->
instance
->
isReadable
(
'/
folder'
));
$this
->
assertTrue
(
$this
->
instance
->
isUpdatable
(
'/
folder'
));
$this
->
assertTrue
(
$this
->
instance
->
file_exists
(
'/
'
.
$directory
));
$this
->
assertTrue
(
$this
->
instance
->
is_dir
(
'/
'
.
$directory
));
$this
->
assertFalse
(
$this
->
instance
->
is_file
(
'/
'
.
$directory
));
$this
->
assertEquals
(
'dir'
,
$this
->
instance
->
filetype
(
'/
'
.
$directory
));
$this
->
assertEquals
(
0
,
$this
->
instance
->
filesize
(
'/
'
.
$directory
));
$this
->
assertTrue
(
$this
->
instance
->
isReadable
(
'/
'
.
$directory
));
$this
->
assertTrue
(
$this
->
instance
->
isUpdatable
(
'/
'
.
$directory
));
$dh
=
$this
->
instance
->
opendir
(
'/'
);
$content
=
array
();
...
...
@@ -62,14 +65,14 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$content
[]
=
$file
;
}
}
$this
->
assertEquals
(
array
(
'folder'
),
$content
);
$this
->
assertEquals
(
array
(
$directory
),
$content
);
$this
->
assertFalse
(
$this
->
instance
->
mkdir
(
'/
folder'
));
//cant create existing folders
$this
->
assertTrue
(
$this
->
instance
->
rmdir
(
'/
folder'
));
$this
->
assertFalse
(
$this
->
instance
->
mkdir
(
'/
'
.
$directory
));
//cant create existing folders
$this
->
assertTrue
(
$this
->
instance
->
rmdir
(
'/
'
.
$directory
));
$this
->
assertFalse
(
$this
->
instance
->
file_exists
(
'/
folder'
));
$this
->
assertFalse
(
$this
->
instance
->
file_exists
(
'/
'
.
$directory
));
$this
->
assertFalse
(
$this
->
instance
->
rmdir
(
'/
folder'
));
//cant remove non existing folders
$this
->
assertFalse
(
$this
->
instance
->
rmdir
(
'/
'
.
$directory
));
//cant remove non existing folders
$dh
=
$this
->
instance
->
opendir
(
'/'
);
$content
=
array
();
...
...
@@ -81,6 +84,14 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
array
(),
$content
);
}
public
function
directoryProvider
()
{
return
array
(
array
(
'folder'
),
array
(
' folder'
),
array
(
'folder '
),
);
}
/**
* test the various uses of file_get_contents and file_put_contents
*/
...
...
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