diff options
author | Frederic Guillot <fred@kanboard.net> | 2017-02-05 19:34:12 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2017-02-05 19:34:12 -0500 |
commit | 3e1b1e02494f7bc4512a355cc6a198b7786f8cfe (patch) | |
tree | 0f0d456e34c408e691e2a88ecf7a9af6ddda4fa7 /tests/units/Core/Ldap/ClientTest.php | |
parent | 53b0c7bda9a7dd1a7c36d44987bba1329b3890bb (diff) |
Improve LDAP error reporting
Diffstat (limited to 'tests/units/Core/Ldap/ClientTest.php')
-rw-r--r-- | tests/units/Core/Ldap/ClientTest.php | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/units/Core/Ldap/ClientTest.php b/tests/units/Core/Ldap/ClientTest.php index d149500e..9f007c28 100644 --- a/tests/units/Core/Ldap/ClientTest.php +++ b/tests/units/Core/Ldap/ClientTest.php @@ -13,6 +13,21 @@ function ldap_set_option() { } +function ldap_get_option($link_identifier, $option, &$error) +{ + $error = 'some extended error'; +} + +function ldap_error($link_identifier) +{ + return 'some error'; +} + +function ldap_errno($link_identifier) +{ + return -100; +} + function ldap_bind($link_identifier, $bind_rdn = null, $bind_password = null) { return ClientTest::$functions->ldap_bind($link_identifier, $bind_rdn, $bind_password); @@ -26,7 +41,6 @@ function ldap_start_tls($link_identifier) class ClientTest extends \Base { public static $functions; - private $ldap; public function setUp() { @@ -37,8 +51,11 @@ class ClientTest extends \Base ->setMethods(array( 'ldap_connect', 'ldap_set_option', + 'ldap_get_option', 'ldap_bind', 'ldap_start_tls', + 'ldap_error', + 'ldap_errno' )) ->getMock(); } @@ -83,7 +100,7 @@ class ClientTest extends \Base ) ->will($this->returnValue(false)); - $this->setExpectedException('\Kanboard\Core\Ldap\ClientException'); + $this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException'); $ldap = new Client; $ldap->open('my_ldap_server'); @@ -133,7 +150,7 @@ class ClientTest extends \Base ) ->will($this->returnValue(false)); - $this->setExpectedException('\Kanboard\Core\Ldap\ClientException'); + $this->setExpectedException('\Kanboard\Core\Ldap\ConnectionException'); $ldap = new Client; $ldap->open('my_ldap_server', 389, true); |