Code Duplication    Length = 7-10 lines in 3 locations

projects/plugins/jetpack/tests/php/general/test_class.jetpack.php 3 locations

@@ 331-337 (lines=7) @@
328
		$this->assertInternalType( 'int', get_transient( 'jetpack_other_linked_admins' ) );
329
	}
330
331
	public function test_promoting_admin_clears_other_linked_admins_transient() {
332
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );
333
		$editor_user = $this->factory->user->create( array( 'role' => 'editor' ) );
334
		wp_update_user( array( 'ID' => $editor_user, 'role' => 'administrator' ) );
335
336
		$this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) );
337
	}
338
339
	public function test_demoting_admin_clear_other_linked_admins_transiet() {
340
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );
@@ 339-345 (lines=7) @@
336
		$this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) );
337
	}
338
339
	public function test_demoting_admin_clear_other_linked_admins_transiet() {
340
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );
341
		$admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) );
342
		wp_update_user( array( 'ID' => $admin_user, 'role' => 'editor' ) );
343
344
		$this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) );
345
	}
346
347
	public function test_null_old_roles_clears_linked_admins_transient() {
348
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );
@@ 347-356 (lines=10) @@
344
		$this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) );
345
	}
346
347
	public function test_null_old_roles_clears_linked_admins_transient() {
348
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );
349
		$admin_user = $this->factory->user->create( array( 'role' => 'administrator' ) );
350
		wp_update_user( array( 'ID' => $admin_user, 'role' => 'editor' ) );
351
352
		/** This action is documented in wp-includes/class-wp-user.php */
353
		do_action( 'set_user_role', $admin_user, 'contributor' );
354
355
		$this->assertFalse( get_transient( 'jetpack_other_linked_admins' ) );
356
	}
357
358
	function test_changing_non_admin_roles_does_not_clear_other_linked_admins_transient() {
359
		set_transient( 'jetpack_other_linked_admins', 2, HOUR_IN_SECONDS );