Completed
Push — add/cli-clean ( c51287...a1b904 )
by
unknown
30:43 queued 20:07
created

WP_Test_Jetpack_IDC   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 90 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 18
loc 20
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A test_clear_all_idc_options_clears_expected() 18 18 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
class WP_Test_Jetpack_IDC extends WP_UnitTestCase {
4 View Code Duplication
	function test_clear_all_idc_options_clears_expected() {
5
		$options = array(
6
			'sync_error_idc',
7
			'safe_mode_confirmed',
8
			'migrate_for_idc',
9
		);
10
11
		foreach ( $options as $option ) {
12
			Jetpack_Options::update_option( $option, true );
13
			$this->assertTrue( Jetpack_Options::get_option( $option ) );
14
		}
15
16
		Jetpack_IDC::clear_all_idc_options();
17
18
		foreach ( $options as $option ) {
19
			$this->assertFalse( Jetpack_Options::get_option( $option ) );
20
		}
21
	}
22
}
23