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
05c97009
Commit
05c97009
authored
11 years ago
by
Andreas Fischer
Browse files
Options
Downloads
Patches
Plain Diff
Test whether an expired user share is still accessible.
parent
c7ca8679
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/lib/share/share.php
+33
-0
33 additions, 0 deletions
tests/lib/share/share.php
with
33 additions
and
0 deletions
tests/lib/share/share.php
+
33
−
0
View file @
05c97009
...
...
@@ -264,6 +264,39 @@ class Test_Share extends PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
array
(
'test1.txt'
),
OCP\Share
::
getItemsSharedWith
(
'test'
,
Test_Share_Backend
::
FORMAT_TARGET
));
}
public
function
testShareWithUserExpirationExpired
()
{
OC_User
::
setUserId
(
$this
->
user1
);
$this
->
assertTrue
(
OCP\Share
::
shareItem
(
'test'
,
'test.txt'
,
OCP\Share
::
SHARE_TYPE_USER
,
$this
->
user2
,
OCP\PERMISSION_READ
),
'Failed asserting that user 1 successfully shared text.txt with user 2.'
);
$this
->
assertEquals
(
array
(
'test.txt'
),
OCP\Share
::
getItemShared
(
'test'
,
'test.txt'
,
Test_Share_Backend
::
FORMAT_SOURCE
),
'Failed asserting that test.txt is a shared file of user 1.'
);
OC_User
::
setUserId
(
$this
->
user2
);
$this
->
assertEquals
(
array
(
'test.txt'
),
OCP\Share
::
getItemSharedWith
(
'test'
,
'test.txt'
,
Test_Share_Backend
::
FORMAT_SOURCE
),
'Failed asserting that user 2 has access to test.txt after initial sharing.'
);
OC_User
::
setUserId
(
$this
->
user1
);
$this
->
assertTrue
(
OCP\Share
::
setExpirationDate
(
'test'
,
'test.txt'
,
'2000-01-01 00:00'
),
'Failed asserting that user 1 successfully set an expiration date for the test.txt share.'
);
OC_User
::
setUserId
(
$this
->
user2
);
$this
->
assertFalse
(
OCP\Share
::
getItemSharedWith
(
'test'
,
'test.txt'
,
Test_Share_Backend
::
FORMAT_SOURCE
),
'Failed asserting that user 2 no longer has access to test.txt after expiration.'
);
}
public
function
testShareWithGroup
()
{
// Invalid shares
$message
=
'Sharing test.txt failed, because the group foobar does not exist'
;
...
...
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