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
f3ecf819
Commit
f3ecf819
authored
10 years ago
by
Arthur Schiwon
Browse files
Options
Downloads
Patches
Plain Diff
extend Dummy user and group implementation to pass tests
parent
553c2ad3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/private/group/dummy.php
+30
-3
30 additions, 3 deletions
lib/private/group/dummy.php
lib/private/user/dummy.php
+10
-1
10 additions, 1 deletion
lib/private/user/dummy.php
tests/lib/group/backend.php
+6
-2
6 additions, 2 deletions
tests/lib/group/backend.php
with
46 additions
and
6 deletions
lib/private/group/dummy.php
+
30
−
3
View file @
f3ecf819
...
...
@@ -143,7 +143,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
* @return array an array of group names
*/
public
function
getGroups
(
$search
=
''
,
$limit
=
-
1
,
$offset
=
0
)
{
return
array_keys
(
$this
->
groups
);
if
(
empty
(
$search
))
{
return
array_keys
(
$this
->
groups
);
}
$result
=
array
();
foreach
(
array_keys
(
$this
->
groups
)
as
$group
)
{
if
(
stripos
(
$group
,
$search
)
!==
false
)
{
$result
[]
=
$group
;
}
}
return
$result
;
}
/**
...
...
@@ -156,7 +165,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public
function
usersInGroup
(
$gid
,
$search
=
''
,
$limit
=
-
1
,
$offset
=
0
)
{
if
(
isset
(
$this
->
groups
[
$gid
]))
{
return
$this
->
groups
[
$gid
];
if
(
empty
(
$search
))
{
return
$this
->
groups
[
$gid
];
}
$result
=
array
();
foreach
(
$this
->
groups
[
$gid
]
as
$user
)
{
if
(
stripos
(
$user
,
$search
)
!==
false
)
{
$result
[]
=
$user
;
}
}
return
$result
;
}
else
{
return
array
();
}
...
...
@@ -172,7 +190,16 @@ class OC_Group_Dummy extends OC_Group_Backend {
*/
public
function
countUsersInGroup
(
$gid
,
$search
=
''
,
$limit
=
-
1
,
$offset
=
0
)
{
if
(
isset
(
$this
->
groups
[
$gid
]))
{
return
count
(
$this
->
groups
[
$gid
]);
if
(
empty
(
$search
))
{
return
count
(
$this
->
groups
[
$gid
]);
}
$count
=
0
;
foreach
(
$this
->
groups
[
$gid
]
as
$user
)
{
if
(
stripos
(
$user
,
$search
)
!==
false
)
{
$count
++
;
}
}
return
$count
;
}
}
...
...
This diff is collapsed.
Click to expand it.
lib/private/user/dummy.php
+
10
−
1
View file @
f3ecf819
...
...
@@ -105,7 +105,16 @@ class OC_User_Dummy extends OC_User_Backend {
* Get a list of all users.
*/
public
function
getUsers
(
$search
=
''
,
$limit
=
null
,
$offset
=
null
)
{
return
array_keys
(
$this
->
users
);
if
(
empty
(
$search
))
{
return
array_keys
(
$this
->
users
);
}
$result
=
array
();
foreach
(
$this
->
users
as
$user
)
{
if
(
stripos
(
$user
,
$search
)
!==
false
)
{
$result
[]
=
$user
;
}
}
return
$result
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
tests/lib/group/backend.php
+
6
−
2
View file @
f3ecf819
...
...
@@ -31,8 +31,12 @@ abstract class Test_Group_Backend extends PHPUnit_Framework_TestCase {
* test cases can override this in order to clean up created groups
* @return string
*/
public
function
getGroupName
()
{
return
uniqid
(
'test_'
);
public
function
getGroupName
(
$name
=
null
)
{
if
(
is_null
(
$name
))
{
return
uniqid
(
'test_'
);
}
else
{
return
$name
;
}
}
/**
...
...
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