Build/Test Tools: Reduce the use of unnecessary randomness in tests.

This increases the overall reliability of the tests.

Props johnillo

Fixes #37371


git-svn-id: https://develop.svn.wordpress.org/trunk@52389 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2021-12-19 13:42:37 +00:00
parent 77757441a4
commit 029bea45b0
46 changed files with 250 additions and 241 deletions

View File

@@ -522,8 +522,8 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
public function test_get_items_invalid_date() {
$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
$request->set_param( 'after', rand_str() );
$request->set_param( 'before', rand_str() );
$request->set_param( 'after', 'foo' );
$request->set_param( 'before', 'bar' );
$response = rest_get_server()->dispatch( $request );
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
}
@@ -570,8 +570,8 @@ class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control
*/
public function test_get_items_invalid_modified_date() {
$request = new WP_REST_Request( 'GET', '/wp/v2/media' );
$request->set_param( 'modified_after', rand_str() );
$request->set_param( 'modified_before', rand_str() );
$request->set_param( 'modified_after', 'foo' );
$request->set_param( 'modified_before', 'bar' );
$response = rest_get_server()->dispatch( $request );
$this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
}