Code Duplication    Length = 27-27 lines in 2 locations

packages/options/tests/Manager.php 2 locations

@@ 62-88 (lines=27) @@
59
		$this->assertTrue( $value );
60
	}
61
62
	function test_delete_non_compact_option_returns_true_when_successfully_deleted() {
63
		\WP_Mock::userFunction( 'get_option', array(
64
			'times' => 1,
65
			'args' => array( 'jetpack_options', array() ),
66
			'return' => array(),
67
		) );
68
		\WP_Mock::userFunction( 'get_option', array(
69
			'times' => 1,
70
			'args' => array( 'jetpack_private_options', array() ),
71
			'return' => array(),
72
		) );
73
		\WP_Mock::userFunction( 'delete_option', array(
74
			'times' => 1,
75
			'args' => array( 'jetpack_uncompact_option_name' ),
76
			'return' => true,
77
		) );
78
		\WP_Mock::userFunction( 'is_multisite', array(
79
			'times' => 1,
80
			'args' => array(),
81
			'return' => false,
82
		) );
83
84
		$deleted = $this->manager->delete_option( 'uncompact_option_name' );
85
86
		// Did Jetpack_Options::delete_option() properly return true?
87
		$this->assertTrue( $deleted );
88
	}
89
90
	function test_delete_network_option_returns_true_when_successfully_deleted() {
91
		\WP_Mock::userFunction( 'get_option', array(
@@ 90-116 (lines=27) @@
87
		$this->assertTrue( $deleted );
88
	}
89
90
	function test_delete_network_option_returns_true_when_successfully_deleted() {
91
		\WP_Mock::userFunction( 'get_option', array(
92
			'times' => 1,
93
			'args' => array( 'jetpack_options', array() ),
94
			'return' => array(),
95
		) );
96
		\WP_Mock::userFunction( 'get_option', array(
97
			'times' => 1,
98
			'args' => array( 'jetpack_private_options', array() ),
99
			'return' => array(),
100
		) );
101
		\WP_Mock::userFunction( 'is_multisite', array(
102
			'times' => 1,
103
			'args' => array(),
104
			'return' => true,
105
		) );
106
		\WP_Mock::userFunction( 'delete_site_option', array(
107
			'times' => 1,
108
			'args' => array( 'jetpack_network_name' ),
109
			'return' => true,
110
		) );
111
112
		$deleted = $this->manager->delete_option( 'network_name' );
113
114
		// Did Jetpack_Options::delete_option() properly return true?
115
		$this->assertTrue( $deleted );
116
	}
117
118
	function test_delete_private_option_returns_true_when_successfully_deleted() {
119
		\WP_Mock::userFunction( 'get_option', array(