mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
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:
@@ -888,8 +888,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
|
||||
public function test_get_comments_invalid_date() {
|
||||
$request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
|
||||
$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 );
|
||||
}
|
||||
@@ -1477,7 +1477,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
'author_email' => 'lovejoy@example.com',
|
||||
'author_url' => 'http://timothylovejoy.jr',
|
||||
'content' => 'It\'s all over\, people! We don\'t have a prayer!',
|
||||
'date' => rand_str(),
|
||||
'date' => 'foo-bar',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
|
||||
@@ -2625,8 +2625,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$params = array(
|
||||
'content' => rand_str(),
|
||||
'date' => rand_str(),
|
||||
'content' => 'content',
|
||||
'date' => 'foo',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
|
||||
@@ -2641,8 +2641,8 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
wp_set_current_user( self::$admin_id );
|
||||
|
||||
$params = array(
|
||||
'content' => rand_str(),
|
||||
'date_gmt' => rand_str(),
|
||||
'content' => 'content',
|
||||
'date_gmt' => 'foo',
|
||||
);
|
||||
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
|
||||
@@ -2770,7 +2770,7 @@ class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase
|
||||
// Change the comment parent.
|
||||
$request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%s', $child_comment ) );
|
||||
$request->set_param( 'parent', $comment_id_1 );
|
||||
$request->set_param( 'content', rand_str() );
|
||||
$request->set_param( 'content', 'foo bar' );
|
||||
$response = rest_get_server()->dispatch( $request );
|
||||
$this->assertSame( 200, $response->get_status() );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user