Completed
Push — renovate/major-eslint-and-plug... ( 32931a...ea602c )
by Jeremy
41:27 queued 30:19
created

Test_Identity_Crisis   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 73.91 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 17
loc 23
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() 17 17 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 //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2
3
/**
4
 * Tests the Identity_Crisis package.
5
 *
6
 * @package automattic/jetpack-identity-crisis
7
 */
8
9
namespace Automattic\Jetpack;
10
11
use Jetpack_Options;
12
use WorDBless\BaseTestCase;
13
14
/**
15
 * Test Identity_Crisis class
16
 */
17
class Test_Identity_Crisis extends BaseTestCase {
18
19
	/**
20
	 * Test that clear_all_idc_options resets Options.
21
	 */
22 View Code Duplication
	public function test_clear_all_idc_options_clears_expected() {
23
		$options = array(
24
			'sync_error_idc',
25
			'safe_mode_confirmed',
26
			'migrate_for_idc',
27
		);
28
29
		foreach ( $options as $option ) {
30
			Jetpack_Options::update_option( $option, true );
31
		}
32
33
		Identity_Crisis::clear_all_idc_options();
34
35
		foreach ( $options as $option ) {
36
			$this->assertFalse( Jetpack_Options::get_option( $option ) );
37
		}
38
	}
39
}
40