Code Duplication    Length = 22-23 lines in 2 locations

_inc/lib/debugger/class-jetpack-cxn-tests.php 2 locations

@@ 215-237 (lines=23) @@
212
	 *
213
	 * @return array
214
	 */
215
	protected function test__blog_token_if_exists() {
216
		$name = __FUNCTION__;
217
218
		if ( ! $this->helper_is_jetpack_connected() ) {
219
			return self::skipped_test(
220
				array(
221
					'name'              => $name,
222
					'short_description' => __( 'Jetpack is not connected. No blog token to check.', 'jetpack' ),
223
				)
224
			);
225
		}
226
		$blog_token = $this->helper_get_blog_token();
227
228
		if ( $blog_token ) {
229
			$result = self::passing_test( array( 'name' => $name ) );
230
		} else {
231
			$connection_error = __( 'Blog token is missing.', 'jetpack' );
232
233
			$result = self::connection_failing_test( $name, $connection_error );
234
		}
235
236
		return $result;
237
	}
238
239
	/**
240
	 * Test if Jetpack is connected.
@@ 290-311 (lines=22) @@
287
	 *
288
	 * @return array Test results.
289
	 */
290
	protected function test__master_user_exists_on_site() {
291
		$name = __FUNCTION__;
292
		if ( ! $this->helper_is_jetpack_connected() ) {
293
			return self::skipped_test(
294
				array(
295
					'name'              => $name,
296
					'short_description' => __( 'Jetpack is not connected. No master user to check.', 'jetpack' ),
297
				)
298
			);
299
		}
300
		$local_user = $this->helper_retrieve_local_master_user();
301
302
		if ( $local_user->exists() ) {
303
			$result = self::passing_test( array( 'name' => $name ) );
304
		} else {
305
			$connection_error = __( 'The user who setup the Jetpack connection no longer exists on this site.', 'jetpack' );
306
307
			$result = self::connection_failing_test( $name, $connection_error );
308
		}
309
310
		return $result;
311
	}
312
313
	/**
314
	 * Test that the master user has the manage options capability (e.g. is an admin).