Code Duplication    Length = 31-49 lines in 2 locations

tests/phpunit/tests/functions.php 2 locations

@@ 198-228 (lines=31) @@
195
		$this->assertSame( is_serialized_string( $value ), $result );
196
	}
197
198
	public function data_is_serialized_string() {
199
		return array(
200
			// Not a string.
201
			array( 0, false ),
202
203
			// Too short when trimmed.
204
			array( 's:3   ', false ),
205
206
			// Too short.
207
			array( 's:3', false ),
208
209
			// No colon in second position.
210
			array( 's!3:"foo";', false ),
211
212
			// No trailing semicolon.
213
			array( 's:3:"foo"', false ),
214
215
			// Wrong type.
216
			array( 'a:3:"foo";', false ),
217
218
			// No closing quote.
219
			array( 'a:3:"foo;', false ),
220
221
			// Wrong number of characters is close enough for is_serialized_string().
222
			array( 's:12:"foo";', true ),
223
224
			// Okay.
225
			array( 's:3:"foo";', true ),
226
227
		);
228
	}
229
230
	/**
231
	 * @group add_query_arg
@@ 464-512 (lines=49) @@
461
		$this->assertEquals( $expected, $actual );
462
	}
463
464
	function data_device_can_upload() {
465
		return array(
466
			// iPhone iOS 5.0.1, Safari 5.1
467
			array(
468
				'Mozilla/5.0 (iPhone; CPU iPhone OS 5_0_1 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Mobile/9A406)',
469
				false,
470
			),
471
			// iPad iOS 3.2, Safari 4.0.4
472
			array(
473
				'Mozilla/5.0 (iPad; U; CPU OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B334b Safari/531.21.10',
474
				false,
475
			),
476
			// iPod iOS 4.3.3, Safari 5.0.2
477
			array(
478
				'Mozilla/5.0 (iPod; U; CPU iPhone OS 4_3_3 like Mac OS X; ja-jp) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5',
479
				false,
480
			),
481
			// iPhone iOS 6.0.0, Safari 6.0
482
			array(
483
				'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
484
				true,
485
			),
486
			// iPad iOS 6.0.0, Safari 6.0
487
			array(
488
				'Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5376e Safari/8536.25',
489
				true,
490
			),
491
			// Android 2.2, Android Webkit Browser
492
			array(
493
				'Mozilla/5.0 (Android 2.2; Windows; U; Windows NT 6.1; en-US) AppleWebKit/533.19.4 (KHTML, like Gecko) Version/5.0.3 Safari/533.19.4',
494
				true,
495
			),
496
			// BlackBerry 9900, BlackBerry browser
497
			array(
498
				'Mozilla/5.0 (BlackBerry; U; BlackBerry 9900; en) AppleWebKit/534.11+ (KHTML, like Gecko) Version/7.1.0.346 Mobile Safari/534.11+',
499
				true,
500
			),
501
			// Windows Phone 8.0, Internet Explorer 10.0;
502
			array(
503
				'Mozilla/5.0 (compatible; MSIE 10.0; Windows Phone 8.0; Trident/6.0; IEMobile/10.0; ARM; Touch; NOKIA; Lumia 920)',
504
				true,
505
			),
506
			// Ubuntu desktop, Firefox 41.0
507
			array(
508
				'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0',
509
				true,
510
			),
511
		);
512
	}
513
514
	/**
515
	 * @ticket 9064