Code Duplication    Length = 13-13 lines in 3 locations

apps/user_ldap/tests/integration/lib/integrationtestconnect.php 3 locations

@@ 100-112 (lines=13) @@
97
	 *
98
	 * @return bool
99
	 */
100
	protected function case3() {
101
		// reset possible LDAP connection
102
		$this->initConnection();
103
		$this->connection->setConfiguration([
104
				'ldapHost' => 'ldap://' . $this->host,
105
		]);
106
		try {
107
			$this->connection->getConnectionResource();
108
		} catch (\OC\ServerNotAvailableException $e) {
109
			return false;
110
		}
111
		return true;
112
	}
113
114
	/**
115
	 * tests that a connect succeeds when an LDAP URL with port is provided
@@ 119-131 (lines=13) @@
116
	 *
117
	 * @return bool
118
	 */
119
	protected function case4() {
120
		// reset possible LDAP connection
121
		$this->initConnection();
122
		$this->connection->setConfiguration([
123
				'ldapHost' => 'ldap://' . $this->host  . ':' . $this->port,
124
		]);
125
		try {
126
			$this->connection->getConnectionResource();
127
		} catch (\OC\ServerNotAvailableException $e) {
128
			return false;
129
		}
130
		return true;
131
	}
132
133
	/**
134
	 * tests that a connect succeeds when a hostname with port is provided
@@ 138-150 (lines=13) @@
135
	 *
136
	 * @return bool
137
	 */
138
	protected function case5() {
139
		// reset possible LDAP connection
140
		$this->initConnection();
141
		$this->connection->setConfiguration([
142
				'ldapHost' => $this->host  . ':' . $this->port,
143
		]);
144
		try {
145
			$this->connection->getConnectionResource();
146
		} catch (\OC\ServerNotAvailableException $e) {
147
			return false;
148
		}
149
		return true;
150
	}
151
152
	/**
153
	 * repeat case1, only to make sure that not a connection was reused by