|
@@ 982-1006 (lines=25) @@
|
| 979 |
|
* |
| 980 |
|
* @since 9.3.0 |
| 981 |
|
*/ |
| 982 |
|
public function test_recommendations_data() { |
| 983 |
|
// Create a user and set it up as current. |
| 984 |
|
$user = $this->create_and_get_user( 'administrator' ); |
| 985 |
|
$user->add_cap( 'jetpack_configure_modules' ); |
| 986 |
|
wp_set_current_user( $user->ID ); |
| 987 |
|
|
| 988 |
|
$test_data = array( |
| 989 |
|
'param1' => 'val1', |
| 990 |
|
'param2' => 'val2', |
| 991 |
|
); |
| 992 |
|
|
| 993 |
|
$response = $this->create_and_get_request( |
| 994 |
|
'recommendations/data', |
| 995 |
|
array( |
| 996 |
|
'data' => $test_data, |
| 997 |
|
), |
| 998 |
|
'POST' |
| 999 |
|
); |
| 1000 |
|
$this->assertResponseStatus( 200, $response ); |
| 1001 |
|
$this->assertTrue( $response->get_data() ); |
| 1002 |
|
|
| 1003 |
|
$response = $this->create_and_get_request( 'recommendations/data', array(), 'GET' ); |
| 1004 |
|
$this->assertResponseStatus( 200, $response ); |
| 1005 |
|
$this->assertResponseData( $test_data, $response ); |
| 1006 |
|
} |
| 1007 |
|
|
| 1008 |
|
/** |
| 1009 |
|
* Test saving and retrieving the recommendations step. |
|
@@ 1013-1034 (lines=22) @@
|
| 1010 |
|
* |
| 1011 |
|
* @since 9.3.0 |
| 1012 |
|
*/ |
| 1013 |
|
public function test_recommendations_step() { |
| 1014 |
|
// Create a user and set it up as current. |
| 1015 |
|
$user = $this->create_and_get_user( 'administrator' ); |
| 1016 |
|
$user->add_cap( 'jetpack_configure_modules' ); |
| 1017 |
|
wp_set_current_user( $user->ID ); |
| 1018 |
|
|
| 1019 |
|
$test_data = 'step-1'; |
| 1020 |
|
|
| 1021 |
|
$response = $this->create_and_get_request( |
| 1022 |
|
'recommendations/step', |
| 1023 |
|
array( |
| 1024 |
|
'step' => $test_data, |
| 1025 |
|
), |
| 1026 |
|
'POST' |
| 1027 |
|
); |
| 1028 |
|
$this->assertResponseStatus( 200, $response ); |
| 1029 |
|
$this->assertTrue( $response->get_data() ); |
| 1030 |
|
|
| 1031 |
|
$response = $this->create_and_get_request( 'recommendations/step', array(), 'GET' ); |
| 1032 |
|
$this->assertResponseStatus( 200, $response ); |
| 1033 |
|
$this->assertResponseData( array( 'step' => $test_data ), $response ); |
| 1034 |
|
} |
| 1035 |
|
|
| 1036 |
|
/** |
| 1037 |
|
* Test saving and retrieving licensing errors. |