Make WordPress Core


Ignore:
Timestamp:
12/19/2021 01:42:37 PM (2 years ago)
Author:
johnbillion
Message:

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

This increases the overall reliability of the tests.

Props johnillo

Fixes #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-comments-controller.php

    r51568 r52389  
    889889    public function test_get_comments_invalid_date() {
    890890        $request = new WP_REST_Request( 'GET', '/wp/v2/comments' );
    891         $request->set_param( 'after', rand_str() );
    892         $request->set_param( 'before', rand_str() );
     891        $request->set_param( 'after', 'foo' );
     892        $request->set_param( 'before', 'bar' );
    893893        $response = rest_get_server()->dispatch( $request );
    894894        $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
     
    14781478            'author_url'   => 'http://timothylovejoy.jr',
    14791479            'content'      => 'It\'s all over\, people! We don\'t have a prayer!',
    1480             'date'         => rand_str(),
     1480            'date'         => 'foo-bar',
    14811481        );
    14821482
     
    26262626
    26272627        $params = array(
    2628             'content' => rand_str(),
    2629             'date'    => rand_str(),
     2628            'content' => 'content',
     2629            'date'    => 'foo',
    26302630        );
    26312631
     
    26422642
    26432643        $params = array(
    2644             'content'  => rand_str(),
    2645             'date_gmt' => rand_str(),
     2644            'content'  => 'content',
     2645            'date_gmt' => 'foo',
    26462646        );
    26472647
     
    27712771        $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%s', $child_comment ) );
    27722772        $request->set_param( 'parent', $comment_id_1 );
    2773         $request->set_param( 'content', rand_str() );
     2773        $request->set_param( 'content', 'foo bar' );
    27742774        $response = rest_get_server()->dispatch( $request );
    27752775        $this->assertSame( 200, $response->get_status() );
Note: See TracChangeset for help on using the changeset viewer.