Make WordPress Core


Ignore:
Timestamp:
08/26/2016 08:21:30 PM (9 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Remove many unnecessary calls to rand_str() which can, in theory, fail at random. Static strings are much more appropriate.

See #37371

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/query/results.php

    r36138 r38382  
    457457     */
    458458    function test_query_author_vars() {
    459         $author_1 = self::factory()->user->create( array( 'user_login' => 'admin1', 'user_pass' => rand_str(), 'role' => 'author' ) );
    460         $post_1 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );
    461 
    462         $author_2 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    463         $post_2 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );
    464 
    465         $author_3 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    466         $post_3 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );
    467 
    468         $author_4 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );
    469         $post_4 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );
     459        $author_1 = self::factory()->user->create( array( 'user_login' => 'author1', 'role' => 'author' ) );
     460        $post_1 = self::factory()->post->create( array( 'post_title' => 'Post 1', 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );
     461
     462        $author_2 = self::factory()->user->create( array( 'user_login' => 'author2', 'role' => 'author' ) );
     463        $post_2 = self::factory()->post->create( array( 'post_title' => 'Post 2', 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );
     464
     465        $author_3 = self::factory()->user->create( array( 'user_login' => 'author3', 'role' => 'author' ) );
     466        $post_3 = self::factory()->post->create( array( 'post_title' => 'Post 3', 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );
     467
     468        $author_4 = self::factory()->user->create( array( 'user_login' => 'author4', 'role' => 'author' ) );
     469        $post_4 = self::factory()->post->create( array( 'post_title' => 'Post 4', 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );
    470470
    471471        $posts = $this->q->query( array(
     
    550550
    551551        $posts = $this->q->query( array(
    552             'author_name' => 'admin1',
     552            'author_name' => 'author1',
    553553            'post__in' => array( $post_1, $post_2, $post_3, $post_4 )
    554554        ) );
Note: See TracChangeset for help on using the changeset viewer.