Code Duplication    Length = 22-25 lines in 2 locations

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

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