Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
e16122f2
Commit
e16122f2
authored
Oct 16, 2014
by
Arthur Schiwon
Browse files
add one simple cache test
parent
4e8c7570
Changes
1
Hide whitespace changes
Inline
Side-by-side
apps/user_ldap/tests/group_ldap.php
View file @
e16122f2
...
...
@@ -59,10 +59,7 @@ class Test_Group_Ldap extends \PHPUnit_Framework_TestCase {
private
function
enableGroups
(
$access
)
{
$access
->
connection
->
expects
(
$this
->
any
())
->
method
(
'__get'
)
->
will
(
$this
->
returnCallback
(
function
(
$name
)
{
// if($name === 'ldapLoginFilter') {
// return '%uid';
// }
->
will
(
$this
->
returnCallback
(
function
()
{
return
1
;
}));
}
...
...
@@ -269,4 +266,32 @@ class Test_Group_Ldap extends \PHPUnit_Framework_TestCase {
$this
->
assertSame
(
false
,
$gid
);
}
/**
* tests whether Group Backend behaves correctly when cache with uid and gid
* is hit
*/
public
function
testInGroupHitsUidGidCache
()
{
$access
=
$this
->
getAccessMock
();
$this
->
enableGroups
(
$access
);
$uid
=
'someUser'
;
$gid
=
'someGroup'
;
$cacheKey
=
'inGroup'
.
$uid
.
':'
.
$gid
;
$access
->
connection
->
expects
(
$this
->
once
())
->
method
(
'isCached'
)
->
with
(
$cacheKey
)
->
will
(
$this
->
returnValue
(
true
));
$access
->
connection
->
expects
(
$this
->
once
())
->
method
(
'getFromCache'
)
->
with
(
$cacheKey
)
->
will
(
$this
->
returnValue
(
true
));
$access
->
expects
(
$this
->
never
())
->
method
(
'username2dn'
);
$groupBackend
=
new
GroupLDAP
(
$access
);
$groupBackend
->
inGroup
(
$uid
,
$gid
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment