Code Duplication    Length = 22-25 lines in 2 locations

projects/plugins/jetpack/tests/php/_inc/lib/test_class.rest-api-endpoints.php 2 locations

@@ 1024-1048 (lines=25) @@
1021
	 *
1022
	 * @since 9.3.0
1023
	 */
1024
	public function test_recommendations_data() {
1025
		// Create a user and set it up as current.
1026
		$user = $this->create_and_get_user( 'administrator' );
1027
		$user->add_cap( 'jetpack_configure_modules' );
1028
		wp_set_current_user( $user->ID );
1029
1030
		$test_data = array(
1031
			'param1' => 'val1',
1032
			'param2' => 'val2',
1033
		);
1034
1035
		$response = $this->create_and_get_request(
1036
			'recommendations/data',
1037
			array(
1038
				'data' => $test_data,
1039
			),
1040
			'POST'
1041
		);
1042
		$this->assertResponseStatus( 200, $response );
1043
		$this->assertTrue( $response->get_data() );
1044
1045
		$response = $this->create_and_get_request( 'recommendations/data', array(), 'GET' );
1046
		$this->assertResponseStatus( 200, $response );
1047
		$this->assertResponseData( $test_data, $response );
1048
	}
1049
1050
	/**
1051
	 * Test saving and retrieving the recommendations step.
@@ 1055-1076 (lines=22) @@
1052
	 *
1053
	 * @since 9.3.0
1054
	 */
1055
	public function test_recommendations_step() {
1056
		// Create a user and set it up as current.
1057
		$user = $this->create_and_get_user( 'administrator' );
1058
		$user->add_cap( 'jetpack_configure_modules' );
1059
		wp_set_current_user( $user->ID );
1060
1061
		$test_data = 'step-1';
1062
1063
		$response = $this->create_and_get_request(
1064
			'recommendations/step',
1065
			array(
1066
				'step' => $test_data,
1067
			),
1068
			'POST'
1069
		);
1070
		$this->assertResponseStatus( 200, $response );
1071
		$this->assertTrue( $response->get_data() );
1072
1073
		$response = $this->create_and_get_request( 'recommendations/step', array(), 'GET' );
1074
		$this->assertResponseStatus( 200, $response );
1075
		$this->assertResponseData( array( 'step' => $test_data ), $response );
1076
	}
1077
1078
	/**
1079
	 * Test saving and retrieving licensing errors.