| @@ 78-91 (lines=14) @@ | ||
| 75 | * |
|
| 76 | * @return bool |
|
| 77 | */ |
|
| 78 | protected function case2() { |
|
| 79 | // reset possible LDAP connection |
|
| 80 | $this->initConnection(); |
|
| 81 | try { |
|
| 82 | $this->connection->setConfiguration([ |
|
| 83 | 'ldap_backup_host' => 'qwertz.uiop', |
|
| 84 | 'ldap_backup_port' => '32123', |
|
| 85 | ]); |
|
| 86 | $this->connection->getConnectionResource(); |
|
| 87 | } catch (\OC\ServerNotAvailableException $e) { |
|
| 88 | return true; |
|
| 89 | } |
|
| 90 | return false; |
|
| 91 | } |
|
| 92 | ||
| 93 | /** |
|
| 94 | * ensures that an exception is thrown if main LDAP server is down and a |
|
| @@ 99-112 (lines=14) @@ | ||
| 96 | * |
|
| 97 | * @return bool |
|
| 98 | */ |
|
| 99 | protected function case3() { |
|
| 100 | // reset possible LDAP connection |
|
| 101 | $this->initConnection(); |
|
| 102 | try { |
|
| 103 | $this->connection->setConfiguration([ |
|
| 104 | 'ldap_backup_host' => '', |
|
| 105 | 'ldap_backup_port' => '', |
|
| 106 | ]); |
|
| 107 | $this->connection->getConnectionResource(); |
|
| 108 | } catch (\OC\ServerNotAvailableException $e) { |
|
| 109 | return true; |
|
| 110 | } |
|
| 111 | return false; |
|
| 112 | } |
|
| 113 | } |
|
| 114 | ||
| 115 | require_once(__DIR__ . '/../setup-scripts/config.php'); |
|
| @@ 62-74 (lines=13) @@ | ||
| 59 | * |
|
| 60 | * @return bool |
|
| 61 | */ |
|
| 62 | protected function case1() { |
|
| 63 | // reset possible LDAP connection |
|
| 64 | $this->initConnection(); |
|
| 65 | $this->connection->setConfiguration([ |
|
| 66 | 'ldapHost' => 'qwertz.uiop', |
|
| 67 | ]); |
|
| 68 | try { |
|
| 69 | $this->connection->getConnectionResource(); |
|
| 70 | } catch (\OC\ServerNotAvailableException $e) { |
|
| 71 | return true; |
|
| 72 | } |
|
| 73 | return false; |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * tests that a connect succeeds when only a hostname is provided |
|