Add unit test to test filtering by field when getting system status

This commit is contained in:
Rodrigo Primo 2020-01-08 15:33:42 -03:00 committed by Claudio Sanches
parent 0cfbc27a27
commit 64f09329dd
1 changed files with 20 additions and 0 deletions

View File

@ -106,6 +106,26 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
$this->assertEquals( WC()->version, $environment['version'] );
}
/**
* Test to make sure that it is possible to filter
* the environment fields returned in the response.
*/
public function test_get_system_status_info_environment_filtered_by_field() {
$expected_data = array(
'environment' => array(
'version' => WC()->version
)
);
$request = new WP_REST_Request( 'GET', '/wc/v3/system_status' );
$request->set_query_params( array( '_fields' => 'environment.version' ) );
$response = $this->server->dispatch( $request );
$data = $response->get_data();
$this->assertEquals( $expected_data, $data );
}
/**
* Test to make sure database response is correct.
*