Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lib
unicaen
auth
Commits
d67106ab
Commit
d67106ab
authored
Jul 10, 2013
by
Bertrand Gauthier
Browse files
Ajout tests pour meilleure couverture.
parent
81399c57
Changes
1
Hide whitespace changes
Inline
Side-by-side
tests/UnicaenAuthTest/Authentication/Storage/LdapDbTest.php
View file @
d67106ab
...
@@ -45,6 +45,22 @@ class LdapDbTest extends PHPUnit_Framework_TestCase
...
@@ -45,6 +45,22 @@ class LdapDbTest extends PHPUnit_Framework_TestCase
->
setServiceManager
(
$this
->
serviceManager
);
->
setServiceManager
(
$this
->
serviceManager
);
}
}
public
function
testServiceManagerIsNullByDefault
()
{
$storage
=
new
LdapDb
();
$this
->
assertNull
(
$storage
->
getServiceManager
());
}
public
function
testCanRetrieveDefaultOptionsFromServiceManager
()
{
$this
->
serviceManager
=
$this
->
getMock
(
'Zend\ServiceManager\ServiceManager'
,
array
(
'get'
));
$this
->
serviceManager
->
expects
(
$this
->
once
())
->
method
(
'get'
)
->
will
(
$this
->
returnValue
(
new
\
UnicaenAuth\Options\ModuleOptions
()));
$this
->
storage
->
setServiceManager
(
$this
->
serviceManager
);
$this
->
storage
->
getOptions
();
}
public
function
testInnerStoragesAreNullByDefault
()
public
function
testInnerStoragesAreNullByDefault
()
{
{
$storage
=
new
LdapDb
();
$storage
=
new
LdapDb
();
...
@@ -52,16 +68,21 @@ class LdapDbTest extends PHPUnit_Framework_TestCase
...
@@ -52,16 +68,21 @@ class LdapDbTest extends PHPUnit_Framework_TestCase
$this
->
assertNull
(
$storage
->
getLdapStorage
());
$this
->
assertNull
(
$storage
->
getLdapStorage
());
}
}
public
function
testStorageIsEmptyOnlyIfInnerStoragesAre
Both
Empty
()
public
function
testStorageIsEmptyOnlyIf
Both
InnerStoragesAreEmpty
()
{
{
$this
->
storage
->
getDbStorage
()
->
write
(
'content'
);
$this
->
storage
->
getDbStorage
()
->
write
(
'content'
);
$this
->
storage
->
getLdapStorage
()
->
write
(
'content'
);
$this
->
assertFalse
(
$this
->
storage
->
isEmpty
());
$this
->
assertFalse
(
$this
->
storage
->
isEmpty
());
$this
->
storage
->
getDbStorage
()
->
clear
();
$this
->
storage
->
clear
();
$this
->
storage
->
getLdapStorage
()
->
write
(
'content'
);
$this
->
storage
->
getLdapStorage
()
->
write
(
'content'
);
$this
->
assertFalse
(
$this
->
storage
->
isEmpty
());
$this
->
assertFalse
(
$this
->
storage
->
isEmpty
());
$this
->
storage
->
getLdapStorage
()
->
clear
();
$this
->
storage
->
clear
();
$this
->
storage
->
getDbStorage
()
->
write
(
'content'
);
$this
->
assertFalse
(
$this
->
storage
->
isEmpty
());
$this
->
storage
->
clear
();
$this
->
assertTrue
(
$this
->
storage
->
isEmpty
());
$this
->
assertTrue
(
$this
->
storage
->
isEmpty
());
}
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment