Code Duplication    Length = 8-8 lines in 5 locations

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

@@ 145-152 (lines=8) @@
142
	 * @return array
143
	 */
144
	protected function test__blog_token_if_exists() {
145
		if ( ! $this->helper_is_jetpack_connected() ) {
146
			return self::skipped_test(
147
				array(
148
					'name'              => __FUNCTION__,
149
					'short_description' => __( 'Jetpack is not connected. No blog token to check.', 'jetpack' ),
150
				)
151
			);
152
		}
153
		$blog_token = $this->helper_get_blog_token();
154
155
		if ( $blog_token ) {
@@ 177-184 (lines=8) @@
174
	protected function test__check_if_connected() {
175
		$name = __FUNCTION__;
176
177
		if ( ! $this->helper_get_blog_token() ) {
178
			return self::skipped_test(
179
				array(
180
					'name'              => $name,
181
					'short_description' => __( 'Blog token is missing.', 'jetpack' ),
182
				)
183
			);
184
		}
185
186
		if ( $this->helper_is_jetpack_connected() ) {
187
			$result = self::passing_test(
@@ 238-245 (lines=8) @@
235
	 */
236
	protected function test__master_user_exists_on_site() {
237
		$name = __FUNCTION__;
238
		if ( ! $this->helper_is_jetpack_connected() ) {
239
			return self::skipped_test(
240
				array(
241
					'name'              => $name,
242
					'short_description' => __( 'Jetpack is not connected. No master user to check.', 'jetpack' ),
243
				)
244
			);
245
		}
246
		$local_user = $this->helper_retrieve_local_master_user();
247
248
		if ( $local_user->exists() ) {
@@ 273-280 (lines=8) @@
270
	 */
271
	protected function test__master_user_can_manage_options() {
272
		$name = __FUNCTION__;
273
		if ( ! $this->helper_is_jetpack_connected() ) {
274
			return self::skipped_test(
275
				array(
276
					'name'              => $name,
277
					'short_description' => __( 'Jetpack is not connected.', 'jetpack' ),
278
				)
279
			);
280
		}
281
		$master_user = $this->helper_retrieve_local_master_user();
282
283
		if ( user_can( $master_user, 'manage_options' ) ) {
@@ 380-387 (lines=8) @@
377
	 */
378
	protected function test__identity_crisis() {
379
		$name = __FUNCTION__;
380
		if ( ! $this->helper_is_jetpack_connected() ) {
381
			return self::skipped_test(
382
				array(
383
					'name'              => $name,
384
					'short_description' => __( 'Jetpack is not connected.', 'jetpack' ),
385
				)
386
			);
387
		}
388
		$identity_crisis = Jetpack::check_identity_crisis();
389
390
		if ( ! $identity_crisis ) {