From a8a8bfb0afdd105980181a5fa11701028ff5adfe Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 2 Jul 2016 18:23:47 -0400 Subject: Added more unit tests for LDAP user class --- tests/units/Core/Ldap/LdapUserTest.php | 60 ++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) (limited to 'tests/units/Core') diff --git a/tests/units/Core/Ldap/LdapUserTest.php b/tests/units/Core/Ldap/LdapUserTest.php index 505b8a03..143a8c0d 100644 --- a/tests/units/Core/Ldap/LdapUserTest.php +++ b/tests/units/Core/Ldap/LdapUserTest.php @@ -845,4 +845,64 @@ class LdapUserTest extends Base $this->assertTrue($this->user->hasGroupUserFilter()); } + + public function testHasGroupsConfigured() + { + $this->user + ->expects($this->any()) + ->method('getGroupAdminDn') + ->will($this->returnValue('something')); + + $this->user + ->expects($this->any()) + ->method('getGroupManagerDn') + ->will($this->returnValue('something')); + + $this->assertTrue($this->user->hasGroupsConfigured()); + } + + public function testHasGroupAdminDnConfigured() + { + $this->user + ->expects($this->any()) + ->method('getGroupAdminDn') + ->will($this->returnValue('something')); + + $this->user + ->expects($this->any()) + ->method('getGroupManagerDn') + ->will($this->returnValue('')); + + $this->assertTrue($this->user->hasGroupsConfigured()); + } + + public function testHasGroupManagerDnConfigured() + { + $this->user + ->expects($this->any()) + ->method('getGroupAdminDn') + ->will($this->returnValue('')); + + $this->user + ->expects($this->any()) + ->method('getGroupManagerDn') + ->will($this->returnValue('something')); + + $this->assertTrue($this->user->hasGroupsConfigured()); + } + + public function testHasGroupsNotConfigured() + { + $this->user + ->expects($this->any()) + ->method('getGroupAdminDn') + ->will($this->returnValue('')); + + $this->user + ->expects($this->any()) + ->method('getGroupManagerDn') + ->will($this->returnValue('')); + + $this->assertFalse($this->user->hasGroupsConfigured()); + } } -- cgit v1.2.3