Code Duplication    Length = 13-14 lines in 6 locations

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-endpoints-accessibility.php 1 location

@@ 57-70 (lines=14) @@
54
	/**
55
	 *  Called before every test.
56
	 */
57
	public function setUp() {
58
		parent::setUp();
59
60
		global $blog_id;
61
62
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
63
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
64
		}
65
66
		$this->set_globals();
67
68
		// Initialize some missing stuff for the API.
69
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
70
	}
71
72
	/**
73
	 * Tests accepts_site_based_authentication method.

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-endpoints.php 1 location

@@ 30-43 (lines=14) @@
27
	/**
28
	 *  Called before every test.
29
	 */
30
	public function setUp() {
31
		parent::setUp();
32
33
		global $blog_id;
34
35
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
36
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
37
		}
38
39
		$this->set_globals();
40
41
		// Initialize some missing stuff for the API.
42
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
43
	}
44
45
	/**
46
	 * Creates a WPCOM_JSON_API_Get_Taxonomy_Endpoint

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-site-endpoints.php 1 location

@@ 27-39 (lines=13) @@
24
	/**
25
	 * Prepare the environment for the test.
26
	 */
27
	public function setUp() {
28
		global $blog_id;
29
30
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
31
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
32
		}
33
34
		parent::setUp();
35
36
		$this->set_globals();
37
38
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
39
	}
40
41
	/**
42
	 * Unit test for the `/sites/%s` endpoint.

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-update-post-endpoints.php 1 location

@@ 27-39 (lines=13) @@
24
	/**
25
	 * Prepare the environment for the test.
26
	 */
27
	public function setUp() {
28
		global $blog_id;
29
30
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
31
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
32
		}
33
34
		parent::setUp();
35
36
		$this->set_globals();
37
38
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
39
	}
40
41
	/**
42
	 * Unit tests the should untrash post protected method.

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-sync-endpoints.php 1 location

@@ 27-39 (lines=13) @@
24
	/**
25
	 * Prepare the environment for the test.
26
	 */
27
	public function setUp() {
28
		global $blog_id;
29
30
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
31
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
32
		}
33
34
		parent::setUp();
35
36
		$this->set_globals();
37
38
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
39
	}
40
41
	/**
42
	 * Unit test for the `/sites/%s/sync/health` endpoint with valid input.

projects/plugins/jetpack/tests/php/json-api/test-class.json-api-jetpack-modules-endpoints.php 1 location

@@ 27-39 (lines=13) @@
24
	/**
25
	 * Prepare the environment for the test.
26
	 */
27
	public function setUp() {
28
		global $blog_id;
29
30
		if ( ! defined( 'WPCOM_JSON_API__BASE' ) ) {
31
			define( 'WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1' );
32
		}
33
34
		parent::setUp();
35
36
		$this->set_globals();
37
38
		WPCOM_JSON_API::init()->token_details = array( 'blog_id' => $blog_id );
39
	}
40
41
	/**
42
	 * Unit test for the `v1.2/modules/%s` endpoint.