Code Duplication    Length = 8-9 lines in 3 locations

projects/plugins/jetpack/tests/php/modules/search/test-class.jetpack-search-helpers.php 3 locations

@@ 109-117 (lines=9) @@
106
		$this->assertContains( 'category=uncategorized', $url );
107
	}
108
109
	function test_add_query_arg_does_not_persist_page() {
110
		$_SERVER['REQUEST_URI'] = "http://example.com/page/2/?s=test&post_type=page";
111
		$_GET['s'] = 'test';
112
113
		$url = Jetpack_Search_Helpers::add_query_arg( 'post_type', 'page' );
114
115
		$this->assertNotContains( '/page/', $url );
116
		$this->assertContains( 's=test', $url );
117
	}
118
119
	function test_remove_query_arg_does_not_persist_page() {
120
		$_SERVER['REQUEST_URI'] = "http://example.com/page/2/?s=test";
@@ 130-137 (lines=8) @@
127
		$this->assertNotContains( 'post_type=', $url );
128
	}
129
130
	function test_add_query_arg_respects_url_passed() {
131
		$input_url = 'http://example.com/page/2/?s=test';
132
		$_SERVER['REQUEST_URI'] = $input_url;
133
		$_GET['s'] = 'test';
134
135
		$url = Jetpack_Search_Helpers::add_query_arg( 'post_type', 'page', $input_url );
136
		$this->assertSame( 'http://example.com/page/2/?s=test&post_type=page', $url );
137
	}
138
139
	function test_remove_query_arg_respects_url_passed() {
140
		$input_url = 'http://example.com/page/2/?s=test&post_type=post,page';
@@ 139-147 (lines=9) @@
136
		$this->assertSame( 'http://example.com/page/2/?s=test&post_type=page', $url );
137
	}
138
139
	function test_remove_query_arg_respects_url_passed() {
140
		$input_url = 'http://example.com/page/2/?s=test&post_type=post,page';
141
		$_SERVER['REQUEST_URI'] = $input_url;
142
		$_GET['s'] = 'test';
143
		$_GET['post_type'] = 'post,page';
144
145
		$url = Jetpack_Search_Helpers::remove_query_arg( 'post_type', $input_url );
146
		$this->assertSame( 'http://example.com/page/2/?s=test', $url );
147
	}
148
149
	function test_get_widget_option_name() {
150
		$this->assertSame( 'widget_jetpack-search-filters', Jetpack_Search_Helpers::get_widget_option_name() );