Completed
Push — add/identity-crisis-package ( 055944...cfc822 )
by
unknown
88:03 queued 77:56
created

Test_Identity_Crisis   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 23
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() 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 //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 View Code Duplication
class Test_Identity_Crisis extends BaseTestCase {
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
18
	/**
19
	 * Test Identity_Crisis.
20
	 */
21
	public function test_clear_all_idc_options_clears_expected() {
22
		$options = array(
23
			'sync_error_idc',
24
			'safe_mode_confirmed',
25
			'migrate_for_idc',
26
		);
27
28
		foreach ( $options as $option ) {
29
			Jetpack_Options::update_option( $option, true );
30
			$this->assertTrue( Jetpack_Options::get_option( $option ) );
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