Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
d0a50fae
Commit
d0a50fae
authored
12 years ago
by
Michael Gapczynski
Browse files
Options
Downloads
Patches
Plain Diff
Fix eTagUpdate and add tests
parent
aea8b0ff
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/files/cache/updater.php
+1
-1
1 addition, 1 deletion
lib/files/cache/updater.php
tests/lib/files/cache/updater.php
+22
-6
22 additions, 6 deletions
tests/lib/files/cache/updater.php
with
23 additions
and
7 deletions
lib/files/cache/updater.php
+
1
−
1
View file @
d0a50fae
...
...
@@ -54,7 +54,7 @@ class Updater {
}
static
public
function
eTagUpdate
(
$path
)
{
if
(
$path
!==
''
)
{
if
(
$path
!==
''
&&
$path
!==
'/'
)
{
$parent
=
dirname
(
$path
);
if
(
$parent
===
'.'
)
{
$parent
=
''
;
...
...
This diff is collapsed.
Click to expand it.
tests/lib/files/cache/updater.php
+
22
−
6
View file @
d0a50fae
...
...
@@ -70,14 +70,18 @@ class Updater extends \PHPUnit_Framework_TestCase {
public
function
testWrite
()
{
$textSize
=
strlen
(
"dummy file data
\n
"
);
$imageSize
=
filesize
(
\OC
::
$SERVERROOT
.
'/core/img/logo.png'
);
$
c
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
c
achedData
[
'size'
]);
$
rootC
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
rootC
achedData
[
'size'
]);
$fooCachedData
=
$this
->
cache
->
get
(
'foo.txt'
);
Filesystem
::
file_put_contents
(
'foo.txt'
,
'asd'
);
$cachedData
=
$this
->
cache
->
get
(
'foo.txt'
);
$this
->
assertEquals
(
3
,
$cachedData
[
'size'
]);
$this
->
assertNotEquals
(
$fooCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
2
*
$textSize
+
$imageSize
+
3
,
$cachedData
[
'size'
]);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
$rootCachedData
=
$cachedData
;
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'bar.txt'
));
Filesystem
::
file_put_contents
(
'bar.txt'
,
'asd'
);
...
...
@@ -86,38 +90,50 @@ class Updater extends \PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
3
,
$cachedData
[
'size'
]);
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
2
*
$textSize
+
$imageSize
+
2
*
3
,
$cachedData
[
'size'
]);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
}
public
function
testDelete
()
{
$textSize
=
strlen
(
"dummy file data
\n
"
);
$imageSize
=
filesize
(
\OC
::
$SERVERROOT
.
'/core/img/logo.png'
);
$
c
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
c
achedData
[
'size'
]);
$
rootC
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
rootC
achedData
[
'size'
]);
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
'foo.txt'
));
Filesystem
::
unlink
(
'foo.txt'
,
'asd'
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'foo.txt'
));
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
2
*
$textSize
+
$imageSize
,
$cachedData
[
'size'
]);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
$rootCachedData
=
$cachedData
;
Filesystem
::
mkdir
(
'bar_folder'
);
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
'bar_folder'
));
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
$rootCachedData
=
$cachedData
;
Filesystem
::
rmdir
(
'bar_folder'
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'bar_folder'
));
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
}
public
function
testRename
()
{
$textSize
=
strlen
(
"dummy file data
\n
"
);
$imageSize
=
filesize
(
\OC
::
$SERVERROOT
.
'/core/img/logo.png'
);
$
c
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
c
achedData
[
'size'
]);
$
rootC
achedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$
rootC
achedData
[
'size'
]);
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
'foo.txt'
));
$fooCachedData
=
$this
->
cache
->
get
(
'foo.txt'
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'bar.txt'
));
Filesystem
::
rename
(
'foo.txt'
,
'bar.txt'
);
$this
->
assertFalse
(
$this
->
cache
->
inCache
(
'foo.txt'
));
$this
->
assertTrue
(
$this
->
cache
->
inCache
(
'bar.txt'
));
$cachedData
=
$this
->
cache
->
get
(
'foo.txt'
);
$this
->
assertNotEquals
(
$fooCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
$cachedData
=
$this
->
cache
->
get
(
''
);
$this
->
assertEquals
(
3
*
$textSize
+
$imageSize
,
$cachedData
[
'size'
]);
$this
->
assertNotEquals
(
$rootCachedData
[
'etag'
],
$cachedData
[
'etag'
]);
}
}
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