Make WordPress Core

Ticket #37371: 37371.2.diff

File 37371.2.diff, 71.5 KB (added by johnillo, 4 years ago)

Replace other rand_str() and rand() calls with static string to eliminate unnecessary randomness in tests. This is my first patch.

  • tests/phpunit/tests/actions.php

    diff --git a/tests/phpunit/tests/actions.php b/tests/phpunit/tests/actions.php
    index ceacc72d7c..3a620d6a25 100644
    a b class Tests_Actions extends WP_UnitTestCase { 
    240240                $this->assertSame( 1, did_action( $tag1 ) );
    241241                $this->assertSame( 0, did_action( $tag2 ) );
    242242
    243                 // Do action $tag2 a random number of times.
    244                 $count = rand( 0, 10 );
     243                // Do action $tag2 10 times.
     244                $count = 10;
    245245                for ( $i = 0; $i < $count; $i++ ) {
    246246                        do_action( $tag2 );
    247247                }
  • tests/phpunit/tests/admin/includesPlugin.php

    diff --git a/tests/phpunit/tests/admin/includesPlugin.php b/tests/phpunit/tests/admin/includesPlugin.php
    index 7542db6b59..e7ecab1997 100644
    a b class Tests_Admin_IncludesPlugin extends WP_UnitTestCase { 
    595595         */
    596596        private function _create_plugin( $data = "<?php\n/*\nPlugin Name: Test\n*/", $filename = false, $dir_path = false ) {
    597597                if ( false === $filename ) {
    598                         $filename = rand_str() . '.php';
     598                        $filename = 'foobar.php';
    599599                }
    600600
    601601                if ( false === $dir_path ) {
  • tests/phpunit/tests/cron.php

    diff --git a/tests/phpunit/tests/cron.php b/tests/phpunit/tests/cron.php
    index 26453c0111..3d1e6d4fe2 100644
    a b class Tests_Cron extends WP_UnitTestCase { 
    247247         */
    248248        function test_unschedule_hook() {
    249249                $hook = __FUNCTION__;
    250                 $args = array( rand_str() );
     250                $args = array( 'foo' );
    251251
    252252                // Schedule several events with and without arguments.
    253253                wp_schedule_single_event( strtotime( '+1 hour' ), $hook );
  • tests/phpunit/tests/date/xmlrpc.php

    diff --git a/tests/phpunit/tests/date/xmlrpc.php b/tests/phpunit/tests/date/xmlrpc.php
    index 6fe96618bc..a019b667c9 100644
    a b class Tests_Date_XMLRPC extends WP_XMLRPC_UnitTestCase { 
    218218                        'comment_author'       => 'Test commenter',
    219219                        'comment_author_url'   => 'http://example.com/',
    220220                        'comment_author_email' => 'example@example.com',
    221                         'comment_content'      => rand_str( 100 ),
     221                        'comment_content'      => 'Hello, world!',
    222222                        'comment_approved'     => '1',
    223223                );
    224224                $comment_id   = wp_insert_comment( $comment_data );
  • tests/phpunit/tests/db/charset.php

    diff --git a/tests/phpunit/tests/db/charset.php b/tests/phpunit/tests/db/charset.php
    index 98bf43a925..2a7cd3d359 100644
    a b class Tests_DB_Charset extends WP_UnitTestCase { 
    10711071         * @covers wpdb::strip_invalid_text_from_query
    10721072         */
    10731073        function test_strip_invalid_text_from_query_cp1251_is_safe() {
    1074                 $tablename = 'test_cp1251_query_' . rand_str( 5 );
     1074                $tablename = 'test_cp1251_query_table';
    10751075                if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) {
    10761076                        $this->markTestSkipped( "Test requires the 'cp1251' charset." );
    10771077                }
    class Tests_DB_Charset extends WP_UnitTestCase { 
    10901090         * @covers wpdb::strip_invalid_text_from_query
    10911091         */
    10921092        function test_no_db_charset_defined() {
    1093                 $tablename = 'test_cp1251_query_' . rand_str( 5 );
     1093                $tablename = 'test_cp1251_query_table';
    10941094                if ( ! self::$_wpdb->query( "CREATE TABLE $tablename ( a VARCHAR(50) ) DEFAULT CHARSET 'cp1251'" ) ) {
    10951095                        $this->markTestSkipped( "Test requires the 'cp1251' charset." );
    10961096                }
  • tests/phpunit/tests/file.php

    diff --git a/tests/phpunit/tests/file.php b/tests/phpunit/tests/file.php
    index 04fd32ff82..ec71719259 100644
    a b class Tests_File extends WP_UnitTestCase { 
    9797                }
    9898
    9999                // Write some random contents.
    100                 $c = rand_str();
     100                $c = 'foobar';
    101101                fwrite( $fp, $c );
    102102                fclose( $fp );
    103103
  • tests/phpunit/tests/hooks/addFilter.php

    diff --git a/tests/phpunit/tests/hooks/addFilter.php b/tests/phpunit/tests/hooks/addFilter.php
    index 5890f22044..593ba509b8 100644
    a b class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    1515                $callback      = '__return_null';
    1616                $hook          = new WP_Hook();
    1717                $tag           = __FUNCTION__;
    18                 $priority      = rand( 1, 100 );
    19                 $accepted_args = rand( 1, 100 );
     18                $priority      = 1;
     19                $accepted_args = 2;
    2020
    2121                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    2222
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    3030                $callback      = array( $a, 'action' );
    3131                $hook          = new WP_Hook();
    3232                $tag           = __FUNCTION__;
    33                 $priority      = rand( 1, 100 );
    34                 $accepted_args = rand( 1, 100 );
     33                $priority      = 1;
     34                $accepted_args = 2;
    3535
    3636                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    3737
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    4444                $callback      = array( 'MockAction', 'action' );
    4545                $hook          = new WP_Hook();
    4646                $tag           = __FUNCTION__;
    47                 $priority      = rand( 1, 100 );
    48                 $accepted_args = rand( 1, 100 );
     47                $priority      = 1;
     48                $accepted_args = 2;
    4949
    5050                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    5151
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    5959                $callback_two  = '__return_false';
    6060                $hook          = new WP_Hook();
    6161                $tag           = __FUNCTION__;
    62                 $priority      = rand( 1, 100 );
    63                 $accepted_args = rand( 1, 100 );
     62                $priority      = 1;
     63                $accepted_args = 2;
    6464
    6565                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    6666                $this->assertCount( 1, $hook->callbacks[ $priority ] );
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    7474                $callback_two  = '__return_false';
    7575                $hook          = new WP_Hook();
    7676                $tag           = __FUNCTION__;
    77                 $priority      = rand( 1, 100 );
    78                 $accepted_args = rand( 1, 100 );
     77                $priority      = 1;
     78                $accepted_args = 2;
    7979
    8080                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    8181                $this->assertCount( 1, $hook->callbacks[ $priority ] );
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    8989                $callback      = '__return_null';
    9090                $hook          = new WP_Hook();
    9191                $tag           = __FUNCTION__;
    92                 $priority      = rand( 1, 100 );
    93                 $accepted_args = rand( 1, 100 );
     92                $priority      = 1;
     93                $accepted_args = 2;
    9494
    9595                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    9696                $this->assertCount( 1, $hook->callbacks[ $priority ] );
    class Tests_Hooks_AddFilter extends WP_UnitTestCase { 
    103103                $callback      = '__return_null';
    104104                $hook          = new WP_Hook();
    105105                $tag           = __FUNCTION__;
    106                 $priority      = rand( 1, 100 );
    107                 $accepted_args = rand( 1, 100 );
     106                $priority      = 1;
     107                $accepted_args = 2;
    108108
    109109                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    110110                $this->assertCount( 1, $hook->callbacks[ $priority ] );
  • tests/phpunit/tests/hooks/applyFilters.php

    diff --git a/tests/phpunit/tests/hooks/applyFilters.php b/tests/phpunit/tests/hooks/applyFilters.php
    index fcb8e3b126..388f85c5c2 100644
    a b class Tests_Hooks_ApplyFilters extends WP_UnitTestCase { 
    1313                $callback      = array( $a, 'filter' );
    1414                $hook          = new WP_Hook();
    1515                $tag           = __FUNCTION__;
    16                 $priority      = rand( 1, 100 );
    17                 $accepted_args = rand( 1, 100 );
     16                $priority      = 1;
     17                $accepted_args = 2;
    1818                $arg           = __FUNCTION__ . '_arg';
    1919
    2020                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    class Tests_Hooks_ApplyFilters extends WP_UnitTestCase { 
    3030                $callback      = array( $a, 'filter' );
    3131                $hook          = new WP_Hook();
    3232                $tag           = __FUNCTION__;
    33                 $priority      = rand( 1, 100 );
    34                 $accepted_args = rand( 1, 100 );
     33                $priority      = 1;
     34                $accepted_args = 2;
    3535                $arg           = __FUNCTION__ . '_arg';
    3636
    3737                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
  • tests/phpunit/tests/hooks/doAction.php

    diff --git a/tests/phpunit/tests/hooks/doAction.php b/tests/phpunit/tests/hooks/doAction.php
    index 0fb5652f3b..5ac1d4d4b9 100644
    a b class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    2121                $callback      = array( $a, 'action' );
    2222                $hook          = new WP_Hook();
    2323                $tag           = __FUNCTION__;
    24                 $priority      = rand( 1, 100 );
    25                 $accepted_args = rand( 1, 100 );
     24                $priority      = 1;
     25                $accepted_args = 2;
    2626                $arg           = __FUNCTION__ . '_arg';
    2727
    2828                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    3636                $callback      = array( $a, 'filter' );
    3737                $hook          = new WP_Hook();
    3838                $tag           = __FUNCTION__;
    39                 $priority      = rand( 1, 100 );
    40                 $accepted_args = rand( 1, 100 );
     39                $priority      = 1;
     40                $accepted_args = 2;
    4141                $arg           = __FUNCTION__ . '_arg';
    4242
    4343                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    5454                $callback_two  = array( $b, 'filter' );
    5555                $hook          = new WP_Hook();
    5656                $tag           = __FUNCTION__;
    57                 $priority      = rand( 1, 100 );
    58                 $accepted_args = rand( 1, 100 );
     57                $priority      = 1;
     58                $accepted_args = 2;
    5959                $arg           = __FUNCTION__ . '_arg';
    6060
    6161                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    7373                $callback_two  = array( $b, 'filter' );
    7474                $hook          = new WP_Hook();
    7575                $tag           = __FUNCTION__;
    76                 $priority      = rand( 1, 100 );
    77                 $accepted_args = rand( 1, 100 );
     76                $priority      = 1;
     77                $accepted_args = 2;
    7878                $arg           = __FUNCTION__ . '_arg';
    7979
    8080                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    8989                $callback      = array( $this, '_action_callback' );
    9090                $hook          = new WP_Hook();
    9191                $tag           = __FUNCTION__;
    92                 $priority      = rand( 1, 100 );
     92                $priority      = 1;
    9393                $accepted_args = 0;
    9494                $arg           = __FUNCTION__ . '_arg';
    9595
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    103103                $callback      = array( $this, '_action_callback' );
    104104                $hook          = new WP_Hook();
    105105                $tag           = __FUNCTION__;
    106                 $priority      = rand( 1, 100 );
     106                $priority      = 1;
    107107                $accepted_args = 1;
    108108                $arg           = __FUNCTION__ . '_arg';
    109109
    class Tests_Hooks_DoAction extends WP_UnitTestCase { 
    117117                $callback      = array( $this, '_action_callback' );
    118118                $hook          = new WP_Hook();
    119119                $tag           = __FUNCTION__;
    120                 $priority      = rand( 1, 100 );
     120                $priority      = 100;
    121121                $accepted_args = 1000;
    122122                $arg           = __FUNCTION__ . '_arg';
    123123
  • tests/phpunit/tests/hooks/doAllHook.php

    diff --git a/tests/phpunit/tests/hooks/doAllHook.php b/tests/phpunit/tests/hooks/doAllHook.php
    index 29eec96428..776c3e4576 100644
    a b class Tests_Hooks_DoAllHook extends WP_UnitTestCase { 
    1313                $callback      = array( $a, 'action' );
    1414                $hook          = new WP_Hook();
    1515                $tag           = 'all';
    16                 $priority      = rand( 1, 100 );
    17                 $accepted_args = rand( 1, 100 );
     16                $priority      = 1;
     17                $accepted_args = 2;
    1818                $arg           = 'all_arg';
    1919
    2020                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
  • tests/phpunit/tests/hooks/hasFilter.php

    diff --git a/tests/phpunit/tests/hooks/hasFilter.php b/tests/phpunit/tests/hooks/hasFilter.php
    index f9d48b3d4e..f6dde3a0f8 100644
    a b class Tests_Hooks_HasFilter extends WP_UnitTestCase { 
    1212                $callback      = '__return_null';
    1313                $hook          = new WP_Hook();
    1414                $tag           = __FUNCTION__;
    15                 $priority      = rand( 1, 100 );
    16                 $accepted_args = rand( 1, 100 );
     15                $priority      = 1;
     16                $accepted_args = 2;
    1717
    1818                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    1919
    class Tests_Hooks_HasFilter extends WP_UnitTestCase { 
    2525                $callback      = array( $a, 'action' );
    2626                $hook          = new WP_Hook();
    2727                $tag           = __FUNCTION__;
    28                 $priority      = rand( 1, 100 );
    29                 $accepted_args = rand( 1, 100 );
     28                $priority      = 1;
     29                $accepted_args = 2;
    3030
    3131                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    3232
    class Tests_Hooks_HasFilter extends WP_UnitTestCase { 
    3737                $callback      = array( 'MockAction', 'action' );
    3838                $hook          = new WP_Hook();
    3939                $tag           = __FUNCTION__;
    40                 $priority      = rand( 1, 100 );
    41                 $accepted_args = rand( 1, 100 );
     40                $priority      = 1;
     41                $accepted_args = 2;
    4242
    4343                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    4444
    class Tests_Hooks_HasFilter extends WP_UnitTestCase { 
    4949                $callback      = '__return_null';
    5050                $hook          = new WP_Hook();
    5151                $tag           = __FUNCTION__;
    52                 $priority      = rand( 1, 100 );
    53                 $accepted_args = rand( 1, 100 );
     52                $priority      = 1;
     53                $accepted_args = 2;
    5454
    5555                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    5656
    class Tests_Hooks_HasFilter extends WP_UnitTestCase { 
    7474                $callback      = '__return_null';
    7575                $hook          = new WP_Hook();
    7676                $tag           = __FUNCTION__;
    77                 $priority      = rand( 1, 100 );
    78                 $accepted_args = rand( 1, 100 );
     77                $priority      = 1;
     78                $accepted_args = 2;
    7979
    8080                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    8181
  • tests/phpunit/tests/hooks/hasFilters.php

    diff --git a/tests/phpunit/tests/hooks/hasFilters.php b/tests/phpunit/tests/hooks/hasFilters.php
    index f5c1e657fc..068ec88e52 100644
    a b class Tests_Hooks_HasFilters extends WP_UnitTestCase { 
    1212                $callback      = '__return_null';
    1313                $hook          = new WP_Hook();
    1414                $tag           = __FUNCTION__;
    15                 $priority      = rand( 1, 100 );
    16                 $accepted_args = rand( 1, 100 );
     15                $priority      = 1;
     16                $accepted_args = 2;
    1717
    1818                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    1919
    class Tests_Hooks_HasFilters extends WP_UnitTestCase { 
    2929                $callback      = '__return_null';
    3030                $hook          = new WP_Hook();
    3131                $tag           = __FUNCTION__;
    32                 $priority      = rand( 1, 100 );
    33                 $accepted_args = rand( 1, 100 );
     32                $priority      = 1;
     33                $accepted_args = 2;
    3434
    3535                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    3636                $hook->remove_filter( $tag, $callback, $priority );
    class Tests_Hooks_HasFilters extends WP_UnitTestCase { 
    4141                $callback      = '__return_null';
    4242                $hook          = new WP_Hook();
    4343                $tag           = __FUNCTION__;
    44                 $priority      = rand( 1, 100 );
    45                 $accepted_args = rand( 1, 100 );
     44                $priority      = 1;
     45                $accepted_args = 2;
    4646
    4747                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    4848                $function_key = _wp_filter_build_unique_id( $tag, $callback, $priority );
  • tests/phpunit/tests/hooks/iterator.php

    diff --git a/tests/phpunit/tests/hooks/iterator.php b/tests/phpunit/tests/hooks/iterator.php
    index 4840aa3d4d..0bfdcab36b 100644
    a b class Tests_Hooks_Iterator extends WP_UnitTestCase { 
    1313                $callback_two  = '__return_false';
    1414                $hook          = new WP_Hook();
    1515                $tag           = __FUNCTION__;
    16                 $priority      = rand( 1, 100 );
    17                 $accepted_args = rand( 1, 100 );
     16                $priority      = 1;
     17                $accepted_args = 2;
    1818
    1919                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    2020                $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
  • tests/phpunit/tests/hooks/preinitHooks.php

    diff --git a/tests/phpunit/tests/hooks/preinitHooks.php b/tests/phpunit/tests/hooks/preinitHooks.php
    index 551d64400f..18afaf6992 100644
    a b class Tests_Hooks_PreinitHooks extends WP_UnitTestCase { 
    1010
    1111        public function test_array_to_hooks() {
    1212                $tag1      = __FUNCTION__ . '_1';
    13                 $priority1 = rand( 1, 100 );
     13                $priority1 = 1;
    1414                $tag2      = __FUNCTION__ . '_2';
    15                 $priority2 = rand( 1, 100 );
     15                $priority2 = 2;
    1616                $filters   = array(
    1717                        $tag1 => array(
    1818                                $priority1 => array(
  • tests/phpunit/tests/hooks/removeAllFilters.php

    diff --git a/tests/phpunit/tests/hooks/removeAllFilters.php b/tests/phpunit/tests/hooks/removeAllFilters.php
    index cfaf81f4c8..90b8a06cda 100644
    a b class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase { 
    1212                $callback      = '__return_null';
    1313                $hook          = new WP_Hook();
    1414                $tag           = __FUNCTION__;
    15                 $priority      = rand( 1, 100 );
    16                 $accepted_args = rand( 1, 100 );
     15                $priority      = 1;
     16                $accepted_args = 2;
    1717
    1818                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    1919
    class Tests_Hooks_RemoveAllFilters extends WP_UnitTestCase { 
    2727                $callback_two  = '__return_false';
    2828                $hook          = new WP_Hook();
    2929                $tag           = __FUNCTION__;
    30                 $priority      = rand( 1, 100 );
    31                 $accepted_args = rand( 1, 100 );
     30                $priority      = 1;
     31                $accepted_args = 2;
    3232
    3333                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    3434                $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
  • tests/phpunit/tests/hooks/removeFilter.php

    diff --git a/tests/phpunit/tests/hooks/removeFilter.php b/tests/phpunit/tests/hooks/removeFilter.php
    index 793cd02b3c..adf8b6ad75 100644
    a b class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { 
    1212                $callback      = '__return_null';
    1313                $hook          = new WP_Hook();
    1414                $tag           = __FUNCTION__;
    15                 $priority      = rand( 1, 100 );
    16                 $accepted_args = rand( 1, 100 );
     15                $priority      = 1;
     16                $accepted_args = 2;
    1717
    1818                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    1919                $hook->remove_filter( $tag, $callback, $priority );
    class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { 
    2626                $callback      = array( $a, 'action' );
    2727                $hook          = new WP_Hook();
    2828                $tag           = __FUNCTION__;
    29                 $priority      = rand( 1, 100 );
    30                 $accepted_args = rand( 1, 100 );
     29                $priority      = 1;
     30                $accepted_args = 2;
    3131
    3232                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    3333                $hook->remove_filter( $tag, $callback, $priority );
    class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { 
    3939                $callback      = array( 'MockAction', 'action' );
    4040                $hook          = new WP_Hook();
    4141                $tag           = __FUNCTION__;
    42                 $priority      = rand( 1, 100 );
    43                 $accepted_args = rand( 1, 100 );
     42                $priority      = 1;
     43                $accepted_args = 2;
    4444
    4545                $hook->add_filter( $tag, $callback, $priority, $accepted_args );
    4646                $hook->remove_filter( $tag, $callback, $priority );
    class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { 
    5353                $callback_two  = '__return_false';
    5454                $hook          = new WP_Hook();
    5555                $tag           = __FUNCTION__;
    56                 $priority      = rand( 1, 100 );
    57                 $accepted_args = rand( 1, 100 );
     56                $priority      = 1;
     57                $accepted_args = 2;
    5858
    5959                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    6060                $hook->add_filter( $tag, $callback_two, $priority, $accepted_args );
    class Tests_Hooks_RemoveFilter extends WP_UnitTestCase { 
    6969                $callback_two  = '__return_false';
    7070                $hook          = new WP_Hook();
    7171                $tag           = __FUNCTION__;
    72                 $priority      = rand( 1, 100 );
    73                 $accepted_args = rand( 1, 100 );
     72                $priority      = 1;
     73                $accepted_args = 2;
    7474
    7575                $hook->add_filter( $tag, $callback_one, $priority, $accepted_args );
    7676                $hook->add_filter( $tag, $callback_two, $priority + 1, $accepted_args );
  • tests/phpunit/tests/image/intermediateSize.php

    diff --git a/tests/phpunit/tests/image/intermediateSize.php b/tests/phpunit/tests/image/intermediateSize.php
    index cf5b3888fe..3efb872457 100644
    a b class Tests_Image_Intermediate_Size extends WP_UnitTestCase { 
    182182         */
    183183        function test_get_intermediate_sizes_by_array_zero_height() {
    184184                // Generate random width.
    185                 $random_w = rand( 300, 400 );
     185                $random_w = 300;
    186186
    187187                // Only one dimention match shouldn't return false positive (see: #17626).
    188188                add_image_size( 'test-size', $random_w, 0, false );
  • tests/phpunit/tests/media.php

    diff --git a/tests/phpunit/tests/media.php b/tests/phpunit/tests/media.php
    index 79cc067712..96b1a159f2 100644
    a b EOF; 
    16361636                $size_array = $this->_get_image_size_array_from_meta( $image_meta, 'medium' );
    16371637
    16381638                // Copy hash generation method used in wp_save_image().
    1639                 $hash = 'e' . time() . rand( 100, 999 );
     1639                $hash = 'e' . time() . 100;
    16401640
    16411641                $filename_base = wp_basename( self::$large_filename, '.jpg' );
    16421642                $filename_hash = "{$filename_base}-{$hash}";
  • tests/phpunit/tests/option/networkOption.php

    diff --git a/tests/phpunit/tests/option/networkOption.php b/tests/phpunit/tests/option/networkOption.php
    index bf2e27504c..6af77dc6fa 100644
    a b class Tests_Option_NetworkOption extends WP_UnitTestCase { 
    8585         * @param $expected_response
    8686         */
    8787        function test_add_network_option_network_id_parameter( $network_id, $expected_response ) {
    88                 $option = rand_str();
    89                 $value  = rand_str();
     88                $option = 'foo';
     89                $value  = 'bar';
    9090
    9191                $this->assertSame( $expected_response, add_network_option( $network_id, $option, $value ) );
    9292        }
    class Tests_Option_NetworkOption extends WP_UnitTestCase { 
    9898         * @param $expected_response
    9999         */
    100100        function test_get_network_option_network_id_parameter( $network_id, $expected_response ) {
    101                 $option = rand_str();
     101                $option = 'baz';
    102102
    103103                $this->assertSame( $expected_response, get_network_option( $network_id, $option, true ) );
    104104        }
  • tests/phpunit/tests/option/transient.php

    diff --git a/tests/phpunit/tests/option/transient.php b/tests/phpunit/tests/option/transient.php
    index 58dd8c2107..8e80b7fec0 100644
    a b class Tests_Option_Transient extends WP_UnitTestCase { 
    3030        }
    3131
    3232        function test_serialized_data() {
    33                 $key   = rand_str();
     33                $key   = __FUNCTION__;
    3434                $value = array(
    3535                        'foo' => true,
    3636                        'bar' => true,
    class Tests_Option_Transient extends WP_UnitTestCase { 
    4949         * @ticket 22807
    5050         */
    5151        function test_transient_data_with_timeout() {
    52                 $key   = rand_str();
    53                 $value = rand_str();
     52                $key   = __FUNCTION__;
     53                $value = 'foobar';
    5454
    5555                $this->assertFalse( get_option( '_transient_timeout_' . $key ) );
    5656                $now = time();
    class Tests_Option_Transient extends WP_UnitTestCase { 
    7070         * @ticket 22807
    7171         */
    7272        function test_transient_add_timeout() {
    73                 $key    = rand_str();
    74                 $value  = rand_str();
    75                 $value2 = rand_str();
     73                $key    = __FUNCTION__;
     74                $value  = 'foo';
     75                $value2 = 'bar';
    7676                $this->assertTrue( set_transient( $key, $value ) );
    7777                $this->assertSame( $value, get_transient( $key ) );
    7878
  • tests/phpunit/tests/post.php

    diff --git a/tests/phpunit/tests/post.php b/tests/phpunit/tests/post.php
    index 16890f91c3..f05d46be0e 100644
    a b class Tests_Post extends WP_UnitTestCase { 
    6868                        $post = array(
    6969                                'post_author'  => self::$editor_id,
    7070                                'post_status'  => 'publish',
    71                                 'post_content' => rand_str(),
    72                                 'post_title'   => rand_str(),
     71                                'post_content' => "{$post_type}_content",
     72                                'post_title'   => "{$post_type}_title",
    7373                                'tax_input'    => array(
    7474                                        'post_tag' => 'tag1,tag2',
    7575                                        'ctax'     => 'cterm1,cterm2',
    class Tests_Post extends WP_UnitTestCase { 
    126126                $post = array(
    127127                        'post_author'  => self::$editor_id,
    128128                        'post_status'  => 'publish',
    129                         'post_content' => rand_str(),
    130                         'post_title'   => rand_str(),
     129                        'post_content' => 'content',
     130                        'post_title'   => 'title',
    131131                        'post_date'    => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
    132132                );
    133133
    class Tests_Post extends WP_UnitTestCase { 
    162162                $post = array(
    163163                        'post_author'  => self::$editor_id,
    164164                        'post_status'  => 'publish',
    165                         'post_content' => rand_str(),
    166                         'post_title'   => rand_str(),
     165                        'post_content' => 'content',
     166                        'post_title'   => 'title',
    167167                        'post_date'    => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
    168168                );
    169169
    class Tests_Post extends WP_UnitTestCase { 
    207207                $post = array(
    208208                        'post_author'  => self::$editor_id,
    209209                        'post_status'  => 'publish',
    210                         'post_content' => rand_str(),
    211                         'post_title'   => rand_str(),
     210                        'post_content' => 'content',
     211                        'post_title'   => 'title',
    212212                        'post_date'    => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
    213213                );
    214214
    class Tests_Post extends WP_UnitTestCase { 
    249249                $post = array(
    250250                        'post_author'  => self::$editor_id,
    251251                        'post_status'  => 'draft',
    252                         'post_content' => rand_str(),
    253                         'post_title'   => rand_str(),
     252                        'post_content' => 'content',
     253                        'post_title'   => 'title',
    254254                        'post_date'    => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
    255255                );
    256256
    class Tests_Post extends WP_UnitTestCase { 
    284284                $post = array(
    285285                        'post_author'  => self::$editor_id,
    286286                        'post_status'  => 'publish',
    287                         'post_content' => rand_str(),
    288                         'post_title'   => rand_str(),
     287                        'post_content' => 'content',
     288                        'post_title'   => 'title',
    289289                        'post_date'    => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
    290290                );
    291291
    class Tests_Post extends WP_UnitTestCase { 
    328328                        $post = array(
    329329                                'post_author'  => self::$editor_id,
    330330                                'post_status'  => 'publish',
    331                                 'post_content' => rand_str(),
    332                                 'post_title'   => rand_str(),
     331                                'post_content' => "{$status}_content",
     332                                'post_title'   => "{$status}_title",
    333333                                'post_date'    => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
    334334                        );
    335335
    class Tests_Post extends WP_UnitTestCase { 
    370370                $post = array(
    371371                        'post_author'  => self::$editor_id,
    372372                        'post_status'  => 'private',
    373                         'post_content' => rand_str(),
    374                         'post_title'   => rand_str(),
     373                        'post_content' => 'content',
     374                        'post_title'   => 'title',
    375375                        'post_date'    => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
    376376                );
    377377
    class Tests_Post extends WP_UnitTestCase { 
    404404                $post = array(
    405405                        'post_author'  => self::$editor_id,
    406406                        'post_status'  => 'publish',
    407                         'post_content' => rand_str(),
    408                         'post_title'   => rand_str(),
     407                        'post_content' => 'content',
     408                        'post_title'   => 'title',
    409409                        'post_date'    => '2012-02-30 00:00:00',
    410410                );
    411411
    class Tests_Post extends WP_UnitTestCase { 
    427427                $post = array(
    428428                        'post_author'  => self::$editor_id,
    429429                        'post_status'  => 'publish',
    430                         'post_content' => rand_str(),
    431                         'post_title'   => rand_str(),
     430                        'post_content' => 'content',
     431                        'post_title'   => 'title',
    432432                        'post_date'    => date_format( date_create( "@{$future_date_1}" ), 'Y-m-d H:i:s' ),
    433433                );
    434434
    class Tests_Post extends WP_UnitTestCase { 
    533533                $post = array(
    534534                        'post_author'  => self::$editor_id,
    535535                        'post_status'  => 'publish',
    536                         'post_content' => rand_str(),
    537                         'post_title'   => rand_str(),
     536                        'post_content' => 'content',
     537                        'post_title'   => 'title',
    538538                        'post_date'    => date_format( date_create( "@{$future_date}" ), 'Y-m-d H:i:s' ),
    539539                );
    540540
    class Tests_Post extends WP_UnitTestCase { 
    564564                $post = array(
    565565                        'post_author'  => self::$editor_id,
    566566                        'post_status'  => 'publish',
    567                         'post_content' => rand_str(),
     567                        'post_content' => 'content',
    568568                        'post_title'   => '',
    569569                        'post_date'    => '2007-10-31 06:15:00',
    570570                );
    class Tests_Post extends WP_UnitTestCase { 
    782782
    783783                register_taxonomy( 'test_tax', 'post' );
    784784
    785                 $title          = rand_str();
     785                $title          = 'title';
    786786                $post_data      = array(
    787787                        'post_author'  => self::$editor_id,
    788788                        'post_status'  => 'publish',
    789                         'post_content' => rand_str(),
     789                        'post_content' => 'content',
    790790                        'post_title'   => $title,
    791791                        'tax_input'    => array(
    792792                                'test_tax' => array( 'term', 'term2', 'term3' ),
    class Tests_Post extends WP_UnitTestCase { 
    805805         * @ticket 24803
    806806         */
    807807        function test_wp_count_posts() {
    808                 $post_type = rand_str( 20 );
     808                $post_type = 'foobar';
    809809                register_post_type( $post_type );
    810810                self::factory()->post->create(
    811811                        array(
    class Tests_Post extends WP_UnitTestCase { 
    820820        }
    821821
    822822        function test_wp_count_posts_filtered() {
    823                 $post_type = rand_str( 20 );
     823                $post_type = 'foobar';
    824824                register_post_type( $post_type );
    825825                self::factory()->post->create_many(
    826826                        3,
    class Tests_Post extends WP_UnitTestCase { 
    906906                register_taxonomy( $tax, $post_type );
    907907
    908908                $post = self::factory()->post->create( array( 'post_type' => $post_type ) );
    909                 wp_set_object_terms( $post, rand_str(), $tax );
     909                wp_set_object_terms( $post, 'term', $tax );
    910910
    911911                $wp_tag_cloud = wp_tag_cloud(
    912912                        array(
    class Tests_Post extends WP_UnitTestCase { 
    973973                        array(
    974974                                'post_author'  => self::$editor_id,
    975975                                'post_status'  => 'publish',
    976                                 'post_content' => rand_str(),
    977                                 'post_title'   => rand_str(),
     976                                'post_content' => 'content',
     977                                'post_title'   => 'title',
    978978                        )
    979979                );
    980980                $post    = get_post( $post_id );
    class Tests_Post extends WP_UnitTestCase { 
    991991                        array(
    992992                                'post_author'  => self::$editor_id,
    993993                                'post_status'  => 'publish',
    994                                 'post_content' => rand_str(),
    995                                 'post_title'   => rand_str(),
     994                                'post_content' => 'content',
     995                                'post_title'   => 'title',
    996996                                'post_type'    => 'page',
    997997                        )
    998998                );
    class Tests_Post extends WP_UnitTestCase { 
    10061006         * @ticket 31168
    10071007         */
    10081008        function test_wp_insert_post_cpt_default_comment_ping_status_open() {
    1009                 $post_type = rand_str( 20 );
     1009                $post_type = 'foobar';
    10101010                register_post_type( $post_type, array( 'supports' => array( 'comments', 'trackbacks' ) ) );
    10111011                $post_id = self::factory()->post->create(
    10121012                        array(
    10131013                                'post_author'  => self::$editor_id,
    10141014                                'post_status'  => 'publish',
    1015                                 'post_content' => rand_str(),
    1016                                 'post_title'   => rand_str(),
     1015                                'post_content' => 'content',
     1016                                'post_title'   => 'title',
    10171017                                'post_type'    => $post_type,
    10181018                        )
    10191019                );
    class Tests_Post extends WP_UnitTestCase { 
    10281028         * @ticket 31168
    10291029         */
    10301030        function test_wp_insert_post_cpt_default_comment_ping_status_closed() {
    1031                 $post_type = rand_str( 20 );
     1031                $post_type = 'foobar';
    10321032                register_post_type( $post_type );
    10331033                $post_id = self::factory()->post->create(
    10341034                        array(
    10351035                                'post_author'  => self::$editor_id,
    10361036                                'post_status'  => 'publish',
    1037                                 'post_content' => rand_str(),
    1038                                 'post_title'   => rand_str(),
     1037                                'post_content' => 'content',
     1038                                'post_title'   => 'title',
    10391039                                'post_type'    => $post_type,
    10401040                        )
    10411041                );
    class Tests_Post extends WP_UnitTestCase { 
    12031203                $post = array(
    12041204                        'post_author'   => self::$editor_id,
    12051205                        'post_status'   => 'publish',
    1206                         'post_content'  => rand_str(),
    1207                         'post_title'    => rand_str(),
     1206                        'post_content'  => 'content',
     1207                        'post_title'    => 'title',
    12081208                        'post_date_gmt' => '2014-01-01 12:00:00',
    12091209                );
    12101210
  • tests/phpunit/tests/post/attachments.php

    diff --git a/tests/phpunit/tests/post/attachments.php b/tests/phpunit/tests/post/attachments.php
    index c3477367f6..d34d91519a 100644
    a b class Tests_Post_Attachments extends WP_UnitTestCase { 
    1414        }
    1515
    1616        function test_insert_bogus_image() {
    17                 $filename = rand_str() . '.jpg';
    18                 $contents = rand_str();
     17                $filename = 'foobar.jpg';
     18                $contents = 'baz';
    1919
    2020                $upload = wp_upload_bits( $filename, null, $contents );
    2121                $this->assertEmpty( $upload['error'] );
    class Tests_Post_Attachments extends WP_UnitTestCase { 
    272272
    273273                $post_id = wp_insert_post(
    274274                        array(
    275                                 'post_content' => rand_str(),
    276                                 'post_title'   => rand_str(),
     275                                'post_content' => 'content',
     276                                'post_title'   => 'title',
    277277                        )
    278278                );
    279279
  • tests/phpunit/tests/post/meta.php

    diff --git a/tests/phpunit/tests/post/meta.php b/tests/phpunit/tests/post/meta.php
    index 1b35df99fd..d9021a9af6 100644
    a b class Tests_Post_Meta extends WP_UnitTestCase { 
    2323                        array(
    2424                                'post_author'  => self::$author->ID,
    2525                                'post_status'  => 'publish',
    26                                 'post_content' => rand_str(),
    27                                 'post_title'   => rand_str(),
     26                                'post_content' => 'content',
     27                                'post_title'   => 'title',
    2828                        )
    2929                );
    3030
    class Tests_Post_Meta extends WP_UnitTestCase { 
    3232                        array(
    3333                                'post_author'  => self::$author->ID,
    3434                                'post_status'  => 'publish',
    35                                 'post_content' => rand_str(),
    36                                 'post_title'   => rand_str(),
     35                                'post_content' => 'content',
     36                                'post_title'   => 'title',
    3737                        )
    3838                );
    3939        }
  • tests/phpunit/tests/post/nav-menu.php

    diff --git a/tests/phpunit/tests/post/nav-menu.php b/tests/phpunit/tests/post/nav-menu.php
    index 4aca66ac0f..912ecef853 100644
    a b class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    1212        function set_up() {
    1313                parent::set_up();
    1414
    15                 $this->menu_id = wp_create_nav_menu( rand_str() );
     15                $this->menu_id = wp_create_nav_menu( 'foobar' );
    1616        }
    1717
    1818        /**
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    225225         * @ticket 29460
    226226         */
    227227        function test_orderby_name_by_default() {
    228                 // We are going to create a random number of menus (min 2, max 10).
    229                 $menus_no = rand( 2, 10 );
     228                $menus_no = 10;
    230229
    231230                for ( $i = 0; $i <= $menus_no; $i++ ) {
    232                         wp_create_nav_menu( rand_str() );
     231                        wp_create_nav_menu( "nav_{$i}" );
    233232                }
    234233
    235234                // This is the expected array of menu names.
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    255254         */
    256255        function test_wp_setup_nav_menu_item_for_post_type_archive() {
    257256
    258                 $post_type_slug        = rand_str( 12 );
    259                 $post_type_description = rand_str();
     257                $post_type_slug        = 'fooo-bar-baz';
     258                $post_type_description = 'foobar';
    260259                register_post_type(
    261260                        $post_type_slug,
    262261                        array(
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    288287         */
    289288        function test_wp_setup_nav_menu_item_for_post_type_archive_no_description() {
    290289
    291                 $post_type_slug        = rand_str( 12 );
     290                $post_type_slug        = 'fooo-bar-baz';
    292291                $post_type_description = '';
    293292                register_post_type(
    294293                        $post_type_slug,
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    319318         */
    320319        function test_wp_setup_nav_menu_item_for_post_type_archive_custom_description() {
    321320
    322                 $post_type_slug        = rand_str( 12 );
    323                 $post_type_description = rand_str();
     321                $post_type_slug        = 'fooo-bar-baz';
     322                $post_type_description = 'foobaz';
    324323                register_post_type(
    325324                        $post_type_slug,
    326325                        array(
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    331330                        )
    332331                );
    333332
    334                 $menu_item_description = rand_str();
     333                $menu_item_description = 'foo_description';
    335334
    336335                $post_type_archive_item_id = wp_update_nav_menu_item(
    337336                        $this->menu_id,
    class Tests_Post_Nav_Menu extends WP_UnitTestCase { 
    354353         */
    355354        function test_wp_setup_nav_menu_item_for_unknown_post_type_archive_no_description() {
    356355
    357                 $post_type_slug = rand_str( 12 );
     356                $post_type_slug = 'fooo-bar-baz';
    358357
    359358                $post_type_archive_item_id = wp_update_nav_menu_item(
    360359                        $this->menu_id,
  • tests/phpunit/tests/post/query.php

    diff --git a/tests/phpunit/tests/post/query.php b/tests/phpunit/tests/post/query.php
    index 6622813ef9..56aca5ffb0 100644
    a b class Tests_Post_Query extends WP_UnitTestCase { 
    132132                $post_id1 = self::factory()->post->create(
    133133                        array(
    134134                                'post_type'  => 'page',
    135                                 'menu_order' => rand( 1, 100 ),
     135                                'menu_order' => 1,
    136136                        )
    137137                );
    138138                $post_id2 = self::factory()->post->create(
    139139                        array(
    140140                                'post_type'  => 'page',
    141                                 'menu_order' => rand( 1, 100 ),
     141                                'menu_order' => 2,
    142142                        )
    143143                );
    144144                $post_id3 = self::factory()->post->create(
    145145                        array(
    146146                                'post_type'   => 'page',
    147147                                'post_parent' => $post_id2,
    148                                 'menu_order'  => rand( 1, 100 ),
     148                                'menu_order'  => 3,
    149149                        )
    150150                );
    151151                $post_id4 = self::factory()->post->create(
    152152                        array(
    153153                                'post_type'   => 'page',
    154154                                'post_parent' => $post_id2,
    155                                 'menu_order'  => rand( 1, 100 ),
     155                                'menu_order'  => 4,
    156156                        )
    157157                );
    158158                $post_id5 = self::factory()->post->create(
    159159                        array(
    160160                                'post_type'  => 'page',
    161                                 'menu_order' => rand( 1, 100 ),
     161                                'menu_order' => 5,
    162162                        )
    163163                );
    164164
    class Tests_Post_Query extends WP_UnitTestCase { 
    219219                        $post_id,
    220220                        array(
    221221                                'post_mime_type' => 'image/jpeg',
    222                                 'menu_order'     => rand( 1, 100 ),
     222                                'menu_order'     => 1,
    223223                        )
    224224                );
    225225                $att_ids[2] = self::factory()->attachment->create_object(
    class Tests_Post_Query extends WP_UnitTestCase { 
    227227                        $post_id,
    228228                        array(
    229229                                'post_mime_type' => 'image/jpeg',
    230                                 'menu_order'     => rand( 1, 100 ),
     230                                'menu_order'     => 2,
    231231                        )
    232232                );
    233233                $att_ids[3] = self::factory()->attachment->create_object(
    class Tests_Post_Query extends WP_UnitTestCase { 
    235235                        $post_id,
    236236                        array(
    237237                                'post_mime_type' => 'image/jpeg',
    238                                 'menu_order'     => rand( 1, 100 ),
     238                                'menu_order'     => 3,
    239239                        )
    240240                );
    241241                $att_ids[4] = self::factory()->attachment->create_object(
    class Tests_Post_Query extends WP_UnitTestCase { 
    243243                        $post_id,
    244244                        array(
    245245                                'post_mime_type' => 'image/jpeg',
    246                                 'menu_order'     => rand( 1, 100 ),
     246                                'menu_order'     => 4,
    247247                        )
    248248                );
    249249                $att_ids[5] = self::factory()->attachment->create_object(
    class Tests_Post_Query extends WP_UnitTestCase { 
    251251                        $post_id,
    252252                        array(
    253253                                'post_mime_type' => 'image/jpeg',
    254                                 'menu_order'     => rand( 1, 100 ),
     254                                'menu_order'     => 5,
    255255                        )
    256256                );
    257257
  • tests/phpunit/tests/post/revisions.php

    diff --git a/tests/phpunit/tests/post/revisions.php b/tests/phpunit/tests/post/revisions.php
    index 840597c4a9..de956b665a 100644
    a b class Tests_Post_Revisions extends WP_UnitTestCase { 
    1717
    1818        function set_up() {
    1919                parent::set_up();
    20                 $this->post_type = rand_str( 20 );
     20                $this->post_type = 'foobar';
    2121        }
    2222
    2323        /**
    class Tests_Post_Revisions extends WP_UnitTestCase { 
    446446                        array(
    447447                                'post_status'  => 'publish',
    448448                                'ID'           => $post_id,
    449                                 'post_content' => rand_str(),
     449                                'post_content' => 'content',
    450450                        )
    451451                );
    452452
  • tests/phpunit/tests/post/types.php

    diff --git a/tests/phpunit/tests/post/types.php b/tests/phpunit/tests/post/types.php
    index a6631d7880..fbc29813f2 100644
    a b class Tests_Post_Types extends WP_UnitTestCase { 
    2121        function set_up() {
    2222                parent::set_up();
    2323
    24                 $this->post_type = rand_str( 20 );
     24                $this->post_type = 'foobar';
    2525        }
    2626
    2727        function test_register_post_type() {
  • tests/phpunit/tests/query/commentCount.php

    diff --git a/tests/phpunit/tests/query/commentCount.php b/tests/phpunit/tests/query/commentCount.php
    index 5c8bd2df26..cf05a5c03c 100644
    a b class Tests_Query_CommentCount extends WP_UnitTestCase { 
    2121        public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    2222                $post_id             = $factory->post->create(
    2323                        array(
    24                                 'post_content' => 1 . rand_str() . ' about',
     24                                'post_content' => '1 about',
    2525                                'post_type'    => self::$post_type,
    2626                        )
    2727                );
    class Tests_Query_CommentCount extends WP_UnitTestCase { 
    3030
    3131                $post_id             = $factory->post->create(
    3232                        array(
    33                                 'post_content' => 1 . rand_str() . ' about',
     33                                'post_content' => '2 about',
    3434                                'post_type'    => self::$post_type,
    3535                        )
    3636                );
    class Tests_Query_CommentCount extends WP_UnitTestCase { 
    4141
    4242                $post_id             = $factory->post->create(
    4343                        array(
    44                                 'post_content' => 1 . rand_str() . ' about',
     44                                'post_content' => '3 about',
    4545                                'post_type'    => self::$post_type,
    4646                        )
    4747                );
    class Tests_Query_CommentCount extends WP_UnitTestCase { 
    5252
    5353                $post_id             = $factory->post->create(
    5454                        array(
    55                                 'post_content' => 1 . rand_str() . ' about',
     55                                'post_content' => '4 about',
    5656                                'post_type'    => self::$post_type,
    5757                        )
    5858                );
  • tests/phpunit/tests/query/search.php

    diff --git a/tests/phpunit/tests/query/search.php b/tests/phpunit/tests/query/search.php
    index 1cc35f4a21..8c5573be77 100644
    a b class Tests_Query_Search extends WP_UnitTestCase { 
    1010        function set_up() {
    1111                parent::set_up();
    1212
    13                 $this->post_type = rand_str( 12 );
     13                $this->post_type = 'foobar';
    1414                register_post_type( $this->post_type );
    1515
    1616                $this->q = new WP_Query();
    class Tests_Query_Search extends WP_UnitTestCase { 
    3636                foreach ( range( 1, 7 ) as $i ) {
    3737                        self::factory()->post->create(
    3838                                array(
    39                                         'post_content' => $i . rand_str() . ' about',
     39                                        'post_content' => "{$i} about",
    4040                                        'post_type'    => $this->post_type,
    4141                                )
    4242                        );
  • tests/phpunit/tests/query/taxQuery.php

    diff --git a/tests/phpunit/tests/query/taxQuery.php b/tests/phpunit/tests/query/taxQuery.php
    index 2ca00b605b..b1e5a5b544 100644
    a b class Tests_Query_TaxQuery extends WP_UnitTestCase { 
    12091209                register_taxonomy_for_object_type( 'post_tag', 'attachment:image' );
    12101210                $tag_id   = self::factory()->term->create(
    12111211                        array(
    1212                                 'slug' => rand_str(),
    1213                                 'name' => rand_str(),
     1212                                'slug' => 'foo-bar',
     1213                                'name' => 'foobar',
    12141214                        )
    12151215                );
    12161216                $image_id = self::factory()->attachment->create_object(
  • tests/phpunit/tests/rest-api/rest-attachments-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-attachments-controller.php b/tests/phpunit/tests/rest-api/rest-attachments-controller.php
    index 14c1f08075..e3815637ae 100644
    a b class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control 
    520520
    521521        public function test_get_items_invalid_date() {
    522522                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    523                 $request->set_param( 'after', rand_str() );
    524                 $request->set_param( 'before', rand_str() );
     523                $request->set_param( 'after', 'foo' );
     524                $request->set_param( 'before', 'bar' );
    525525                $response = rest_get_server()->dispatch( $request );
    526526                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    527527        }
    class WP_Test_REST_Attachments_Controller extends WP_Test_REST_Post_Type_Control 
    568568         */
    569569        public function test_get_items_invalid_modified_date() {
    570570                $request = new WP_REST_Request( 'GET', '/wp/v2/media' );
    571                 $request->set_param( 'modified_after', rand_str() );
    572                 $request->set_param( 'modified_before', rand_str() );
     571                $request->set_param( 'modified_after', 'foo' );
     572                $request->set_param( 'modified_before', 'bar' );
    573573                $response = rest_get_server()->dispatch( $request );
    574574                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    575575        }
  • tests/phpunit/tests/rest-api/rest-comments-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-comments-controller.php b/tests/phpunit/tests/rest-api/rest-comments-controller.php
    index 0c7ed625b7..661c406ebe 100644
    a b class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    888888
    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 );
    895895        }
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    14771477                        'author_email' => 'lovejoy@example.com',
    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'         => 'foobar',
    14811481                );
    14821482
    14831483                $request = new WP_REST_Request( 'POST', '/wp/v2/comments' );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26252625                wp_set_current_user( self::$admin_id );
    26262626
    26272627                $params = array(
    2628                         'content' => rand_str(),
    2629                         'date'    => rand_str(),
     2628                        'content' => 'content',
     2629                        'date'    => 'foo',
    26302630                );
    26312631
    26322632                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    26412641                wp_set_current_user( self::$admin_id );
    26422642
    26432643                $params = array(
    2644                         'content'  => rand_str(),
    2645                         'date_gmt' => rand_str(),
     2644                        'content'  => 'content',
     2645                        'date_gmt' => 'foo',
    26462646                );
    26472647
    26482648                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/comments/%d', self::$approved_id ) );
    class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase 
    27702770                // Change the comment parent.
    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', 'foobar' );
    27742774                $response = rest_get_server()->dispatch( $request );
    27752775                $this->assertSame( 200, $response->get_status() );
    27762776
  • tests/phpunit/tests/rest-api/rest-pages-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-pages-controller.php b/tests/phpunit/tests/rest-api/rest-pages-controller.php
    index 00047cce80..ed5000e242 100644
    a b class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    329329
    330330        public function test_get_items_invalid_date() {
    331331                $request = new WP_REST_Request( 'GET', '/wp/v2/pages' );
    332                 $request->set_param( 'after', rand_str() );
    333                 $request->set_param( 'before', rand_str() );
     332                $request->set_param( 'after', 'foo' );
     333                $request->set_param( 'before', 'bar' );
    334334                $response = rest_get_server()->dispatch( $request );
    335335                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    336336        }
    class WP_Test_REST_Pages_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    368368         */
    369369        public function test_get_items_invalid_modified_date() {
    370370                $request = new WP_REST_Request( 'GET', '/wp/v2/pages' );
    371                 $request->set_param( 'modified_after', rand_str() );
    372                 $request->set_param( 'modified_before', rand_str() );
     371                $request->set_param( 'modified_after', 'foo' );
     372                $request->set_param( 'modified_before', 'bar' );
    373373                $response = rest_get_server()->dispatch( $request );
    374374                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    375375        }
  • tests/phpunit/tests/rest-api/rest-posts-controller.php

    diff --git a/tests/phpunit/tests/rest-api/rest-posts-controller.php b/tests/phpunit/tests/rest-api/rest-posts-controller.php
    index b35921a73d..8a7636c259 100644
    a b class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    16921692
    16931693        public function test_get_items_invalid_date() {
    16941694                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    1695                 $request->set_param( 'after', rand_str() );
    1696                 $request->set_param( 'before', rand_str() );
     1695                $request->set_param( 'after', 'foo' );
     1696                $request->set_param( 'before', 'bar' );
    16971697                $response = rest_get_server()->dispatch( $request );
    16981698                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    16991699        }
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    17171717         */
    17181718        public function test_get_items_invalid_modified_date() {
    17191719                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    1720                 $request->set_param( 'modified_after', rand_str() );
    1721                 $request->set_param( 'modified_before', rand_str() );
     1720                $request->set_param( 'modified_after', 'foo' );
     1721                $request->set_param( 'modified_before', 'bar' );
    17221722                $response = rest_get_server()->dispatch( $request );
    17231723                $this->assertErrorResponse( 'rest_invalid_param', $response, 400 );
    17241724        }
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    26952695                        0,
    26962696                        array(
    26972697                                'post_mime_type' => 'image/jpeg',
    2698                                 'menu_order'     => rand( 1, 100 ),
     2698                                'menu_order'     => 1,
    26992699                        )
    27002700                );
    27012701
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    33083308        public function test_update_post_ignore_readonly() {
    33093309                wp_set_current_user( self::$editor_id );
    33103310
    3311                 $new_content       = rand_str();
     3311                $new_content       = 'foobar';
    33123312                $expected_modified = current_time( 'mysql' );
    33133313
    33143314                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    33733373                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    33743374                $params  = $this->set_post_data(
    33753375                        array(
    3376                                 'date' => rand_str(),
     3376                                'date' => 'foo',
    33773377                        )
    33783378                );
    33793379                $request->set_body_params( $params );
    class WP_Test_REST_Posts_Controller extends WP_Test_REST_Post_Type_Controller_Te 
    33883388                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', self::$post_id ) );
    33893389                $params  = $this->set_post_data(
    33903390                        array(
    3391                                 'date_gmt' => rand_str(),
     3391                                'date_gmt' => 'foo',
    33923392                        )
    33933393                );
    33943394                $request->set_body_params( $params );
  • tests/phpunit/tests/rewrite.php

    diff --git a/tests/phpunit/tests/rewrite.php b/tests/phpunit/tests/rewrite.php
    index 8f54a0dc89..09f82619aa 100644
    a b class Tests_Rewrite extends WP_UnitTestCase { 
    173173        function test_url_to_postid_custom_post_type() {
    174174                delete_option( 'rewrite_rules' );
    175175
    176                 $post_type = rand_str( 12 );
     176                $post_type = 'foobar';
    177177                register_post_type( $post_type, array( 'public' => true ) );
    178178
    179179                $id = self::factory()->post->create( array( 'post_type' => $post_type ) );
  • tests/phpunit/tests/rewrite/numericSlugs.php

    diff --git a/tests/phpunit/tests/rewrite/numericSlugs.php b/tests/phpunit/tests/rewrite/numericSlugs.php
    index e11c6b2a46..41ef636368 100644
    a b class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    2323                        array(
    2424                                'post_author'  => $this->author_id,
    2525                                'post_status'  => 'publish',
    26                                 'post_content' => rand_str(),
     26                                'post_content' => 'content',
    2727                                'post_title'   => '',
    2828                                'post_name'    => '2015',
    2929                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    5353                        array(
    5454                                'post_author'  => $this->author_id,
    5555                                'post_status'  => 'publish',
    56                                 'post_content' => rand_str(),
     56                                'post_content' => 'content',
    5757                                'post_title'   => '',
    5858                                'post_name'    => '2015',
    5959                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    8080                        array(
    8181                                'post_author'  => $this->author_id,
    8282                                'post_status'  => 'publish',
    83                                 'post_content' => rand_str(),
     83                                'post_content' => 'content',
    8484                                'post_title'   => '2015',
    8585                                'post_date'    => '2015-02-01 01:00:00',
    8686                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    9898                        array(
    9999                                'post_author'  => $this->author_id,
    100100                                'post_status'  => 'publish',
    101                                 'post_content' => rand_str(),
     101                                'post_content' => 'content',
    102102                                'post_title'   => '2015',
    103103                                'post_date'    => '2015-02-01 01:00:00',
    104104                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    114114                        array(
    115115                                'post_author'  => $this->author_id,
    116116                                'post_status'  => 'publish',
    117                                 'post_content' => rand_str(),
     117                                'post_content' => 'content',
    118118                                'post_title'   => '',
    119119                                'post_name'    => '02',
    120120                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    133133                        array(
    134134                                'post_author'  => $this->author_id,
    135135                                'post_status'  => 'publish',
    136                                 'post_content' => rand_str(),
     136                                'post_content' => 'content',
    137137                                'post_title'   => '',
    138138                                'post_name'    => '02',
    139139                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    150150                        array(
    151151                                'post_author'  => $this->author_id,
    152152                                'post_status'  => 'publish',
    153                                 'post_content' => rand_str(),
     153                                'post_content' => 'content',
    154154                                'post_title'   => '',
    155155                                'post_name'    => '2',
    156156                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    169169                        array(
    170170                                'post_author'  => $this->author_id,
    171171                                'post_status'  => 'publish',
    172                                 'post_content' => rand_str(),
     172                                'post_content' => 'content',
    173173                                'post_title'   => '',
    174174                                'post_name'    => '2',
    175175                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    186186                        array(
    187187                                'post_author'  => $this->author_id,
    188188                                'post_status'  => 'publish',
    189                                 'post_content' => rand_str(),
     189                                'post_content' => 'content',
    190190                                'post_title'   => '02',
    191191                                'post_date'    => '2015-02-01 01:00:00',
    192192                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    204204                        array(
    205205                                'post_author'  => $this->author_id,
    206206                                'post_status'  => 'publish',
    207                                 'post_content' => rand_str(),
     207                                'post_content' => 'content',
    208208                                'post_title'   => '02',
    209209                                'post_date'    => '2015-02-01 01:00:00',
    210210                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    220220                        array(
    221221                                'post_author'  => $this->author_id,
    222222                                'post_status'  => 'publish',
    223                                 'post_content' => rand_str(),
     223                                'post_content' => 'content',
    224224                                'post_title'   => '2',
    225225                                'post_date'    => '2015-02-01 01:00:00',
    226226                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    238238                        array(
    239239                                'post_author'  => $this->author_id,
    240240                                'post_status'  => 'publish',
    241                                 'post_content' => rand_str(),
     241                                'post_content' => 'content',
    242242                                'post_title'   => '2',
    243243                                'post_date'    => '2015-02-01 01:00:00',
    244244                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    254254                        array(
    255255                                'post_author'  => $this->author_id,
    256256                                'post_status'  => 'publish',
    257                                 'post_content' => rand_str(),
     257                                'post_content' => 'content',
    258258                                'post_title'   => '',
    259259                                'post_name'    => '01',
    260260                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    273273                        array(
    274274                                'post_author'  => $this->author_id,
    275275                                'post_status'  => 'publish',
    276                                 'post_content' => rand_str(),
     276                                'post_content' => 'content',
    277277                                'post_title'   => '',
    278278                                'post_name'    => '01',
    279279                                'post_date'    => '2015-02-01 01:00:00',
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    290290                        array(
    291291                                'post_author'  => $this->author_id,
    292292                                'post_status'  => 'publish',
    293                                 'post_content' => rand_str(),
     293                                'post_content' => 'content',
    294294                                'post_title'   => '01',
    295295                                'post_date'    => '2015-02-01 01:00:00',
    296296                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    308308                        array(
    309309                                'post_author'  => $this->author_id,
    310310                                'post_status'  => 'publish',
    311                                 'post_content' => rand_str(),
     311                                'post_content' => 'content',
    312312                                'post_title'   => '01',
    313313                                'post_date'    => '2015-02-01 01:00:00',
    314314                        )
    class Tests_Rewrite_NumericSlugs extends WP_UnitTestCase { 
    324324                        array(
    325325                                'post_author'  => $this->author_id,
    326326                                'post_status'  => 'publish',
    327                                 'post_content' => rand_str(),
     327                                'post_content' => 'content',
    328328                                'post_title'   => '01',
    329329                                'post_date'    => '2015-02-01 01:00:00',
    330330                        )
  • tests/phpunit/tests/shortcode.php

    diff --git a/tests/phpunit/tests/shortcode.php b/tests/phpunit/tests/shortcode.php
    index 479f6d059a..f315c07151 100644
    a b class Tests_Shortcode extends WP_UnitTestCase { 
    269269        }
    270270
    271271        function test_footag_val() {
    272                 $val = rand_str();
     272                $val = 'baz';
    273273                $out = do_shortcode( '[footag foo="' . $val . '"]' );
    274274                $this->assertSame( 'foo = ' . $val, $out );
    275275        }
  • tests/phpunit/tests/taxonomy.php

    diff --git a/tests/phpunit/tests/taxonomy.php b/tests/phpunit/tests/taxonomy.php
    index 6469563a08..0ae27750bf 100644
    a b class Tests_Taxonomy extends WP_UnitTestCase { 
    1717         */
    1818        function test_get_unknown_taxonomies() {
    1919                // Taxonomies for an unknown object type.
    20                 $this->assertSame( array(), get_object_taxonomies( rand_str() ) );
     20                $this->assertSame( array(), get_object_taxonomies( 'foobar' ) );
    2121                $this->assertSame( array(), get_object_taxonomies( '' ) );
    2222                $this->assertSame( array(), get_object_taxonomies( 0 ) );
    2323                $this->assertSame( array(), get_object_taxonomies( null ) );
    class Tests_Taxonomy extends WP_UnitTestCase { 
    122122        }
    123123
    124124        function test_taxonomy_exists_unknown() {
    125                 $this->assertFalse( taxonomy_exists( rand_str() ) );
     125                $this->assertFalse( taxonomy_exists( 'foobar' ) );
    126126                $this->assertFalse( taxonomy_exists( '' ) );
    127127                $this->assertFalse( taxonomy_exists( 0 ) );
    128128                $this->assertFalse( taxonomy_exists( null ) );
    class Tests_Taxonomy extends WP_UnitTestCase { 
    135135        }
    136136
    137137        function test_is_taxonomy_hierarchical_unknown() {
    138                 $this->assertFalse( is_taxonomy_hierarchical( rand_str() ) );
     138                $this->assertFalse( is_taxonomy_hierarchical( 'foobar' ) );
    139139                $this->assertFalse( is_taxonomy_hierarchical( '' ) );
    140140                $this->assertFalse( is_taxonomy_hierarchical( 0 ) );
    141141                $this->assertFalse( is_taxonomy_hierarchical( null ) );
    class Tests_Taxonomy extends WP_UnitTestCase { 
    144144        function test_register_taxonomy() {
    145145
    146146                // Make up a new taxonomy name, and ensure it's unused.
    147                 $tax = rand_str();
     147                $tax = 'tax_new';
    148148                $this->assertFalse( taxonomy_exists( $tax ) );
    149149
    150150                register_taxonomy( $tax, 'post' );
    class Tests_Taxonomy extends WP_UnitTestCase { 
    158158        function test_register_hierarchical_taxonomy() {
    159159
    160160                // Make up a new taxonomy name, and ensure it's unused.
    161                 $tax = rand_str();
     161                $tax = 'tax_new';
    162162                $this->assertFalse( taxonomy_exists( $tax ) );
    163163
    164164                register_taxonomy( $tax, 'post', array( 'hierarchical' => true ) );
  • tests/phpunit/tests/term.php

    diff --git a/tests/phpunit/tests/term.php b/tests/phpunit/tests/term.php
    index d18b4ef1ff..0fa1a43076 100644
    a b class Tests_Term extends WP_UnitTestCase { 
    5151         */
    5252        function test_is_term_type() {
    5353                // Insert a term.
    54                 $term = rand_str();
     54                $term = 'term_new';
    5555                $t    = wp_insert_term( $term, $this->taxonomy );
    5656                $this->assertIsArray( $t );
    5757                $term_obj = get_term_by( 'name', $term, $this->taxonomy );
    class Tests_Term extends WP_UnitTestCase { 
    128128         * @group category.php
    129129         */
    130130        function test_term_is_ancestor_of() {
    131                 $term  = rand_str();
    132                 $term2 = rand_str();
     131                $term  = 'term';
     132                $term2 = 'term2';
    133133
    134134                $t = wp_insert_term( $term, 'category' );
    135135                $this->assertIsArray( $t );
    class Tests_Term extends WP_UnitTestCase { 
    147147        }
    148148
    149149        function test_wp_insert_delete_category() {
    150                 $term = rand_str();
     150                $term = 'term';
    151151                $this->assertNull( category_exists( $term ) );
    152152
    153153                $initial_count = wp_count_terms( array( 'taxonomy' => 'category' ) );
  • tests/phpunit/tests/term/getTermField.php

    diff --git a/tests/phpunit/tests/term/getTermField.php b/tests/phpunit/tests/term/getTermField.php
    index 9761d87662..b5448c8be0 100644
    a b class Tests_Term_getTermField extends WP_UnitTestCase { 
    9191        }
    9292
    9393        public function test_get_term_field_name() {
    94                 $name = rand_str( 15 );
     94                $name = 'foobar';
    9595
    9696                $term = self::factory()->term->create_and_get(
    9797                        array(
    class Tests_Term_getTermField extends WP_UnitTestCase { 
    106106        }
    107107
    108108        public function test_get_term_field_slug_when_slug_is_set() {
    109                 $slug = rand_str( 15 );
     109                $slug = 'foobar';
    110110
    111111                $term = self::factory()->term->create_and_get(
    112112                        array(
    class Tests_Term_getTermField extends WP_UnitTestCase { 
    121121        }
    122122
    123123        public function test_get_term_field_slug_when_slug_falls_back_from_name() {
    124                 $name = rand_str( 15 );
     124                $name = 'foobar';
    125125
    126126                $term = self::factory()->term->create_and_get(
    127127                        array(
    class Tests_Term_getTermField extends WP_UnitTestCase { 
    156156        }
    157157
    158158        public function test_get_term_field_description() {
    159                 $desc = wpautop( rand_str() );
     159                $desc = wpautop( 'foobar' );
    160160
    161161                $term = self::factory()->term->create_and_get(
    162162                        array(
  • tests/phpunit/tests/term/splitSharedTerm.php

    diff --git a/tests/phpunit/tests/term/splitSharedTerm.php b/tests/phpunit/tests/term/splitSharedTerm.php
    index 65cefe8c4a..b9a13662a0 100644
    a b class Tests_Term_SplitSharedTerm extends WP_UnitTestCase { 
    208208                        array( '%d' )
    209209                );
    210210
    211                 $menu_id       = wp_create_nav_menu( rand_str() );
     211                $menu_id       = wp_create_nav_menu( 'foobar' );
    212212                $cat_menu_item = wp_update_nav_menu_item(
    213213                        $menu_id,
    214214                        0,
  • tests/phpunit/tests/term/termExists.php

    diff --git a/tests/phpunit/tests/term/termExists.php b/tests/phpunit/tests/term/termExists.php
    index 8b57d67cd9..82027bc017 100644
    a b class Tests_TermExists extends WP_UnitTestCase { 
    260260                register_taxonomy( 'wptests_tax', 'post' );
    261261
    262262                // Insert a term.
    263                 $term = rand_str();
     263                $term = 'term';
    264264                $t    = wp_insert_term( $term, 'wptests_tax' );
    265265                $this->assertIsArray( $t );
    266266                $this->assertEquals( $t['term_id'], term_exists( $t['term_id'] ) );
    class Tests_TermExists extends WP_UnitTestCase { 
    272272        }
    273273
    274274        function test_term_exists_unknown() {
    275                 $this->assertNull( term_exists( rand_str() ) );
     275                $this->assertNull( term_exists( 'foobar' ) );
    276276                $this->assertSame( 0, term_exists( 0 ) );
    277277                $this->assertNull( term_exists( '' ) );
    278278                $this->assertNull( term_exists( null ) );
  • tests/phpunit/tests/term/wpSetObjectTerms.php

    diff --git a/tests/phpunit/tests/term/wpSetObjectTerms.php b/tests/phpunit/tests/term/wpSetObjectTerms.php
    index 1db10a651c..7bfa9edaa7 100644
    a b class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { 
    1515         * @ticket 26570
    1616         */
    1717        function test_set_object_terms() {
    18                 $non_hier = rand_str( 10 );
    19                 $hier     = rand_str( 10 );
     18                $non_hier = 'bar';
     19                $hier     = 'baz';
    2020
    2121                // Register taxonomies.
    2222                register_taxonomy( $non_hier, array() );
    class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { 
    133133                $ids = self::$post_ids;
    134134
    135135                $terms = array(
    136                         rand_str(),
    137                         rand_str(),
    138                         rand_str(),
     136                        'term0',
     137                        'term1',
     138                        'term2',
    139139                );
    140140
    141141                foreach ( $ids as $id ) {
    class Tests_Term_WpSetObjectTerms extends WP_UnitTestCase { 
    164164
    165165        function test_set_object_terms_invalid() {
    166166                // Bogus taxonomy.
    167                 $result = wp_set_object_terms( self::$post_ids[0], array( rand_str() ), rand_str() );
     167                $result = wp_set_object_terms( self::$post_ids[0], array( 'foo' ), 'bar' );
    168168                $this->assertWPError( $result );
    169169        }
    170170
  • tests/phpunit/tests/term/wpTaxonomy.php

    diff --git a/tests/phpunit/tests/term/wpTaxonomy.php b/tests/phpunit/tests/term/wpTaxonomy.php
    index a8689284c2..29c51fb0af 100644
    a b class Tests_WP_Taxonomy extends WP_UnitTestCase { 
    1818                /* @var WP $wp */
    1919                global $wp;
    2020
    21                 $taxonomy        = rand_str();
     21                $taxonomy        = 'taxonomy';
    2222                $taxonomy_object = new WP_Taxonomy( $taxonomy, 'post' );
    2323
    2424                $taxonomy_object->add_rewrite_rules();
    class Tests_WP_Taxonomy extends WP_UnitTestCase { 
    3131                /* @var WP $wp */
    3232                global $wp;
    3333
    34                 $taxonomy        = rand_str();
     34                $taxonomy        = 'taxonomy';
    3535                $taxonomy_object = new WP_Taxonomy(
    3636                        $taxonomy,
    3737                        'post',
    class Tests_WP_Taxonomy extends WP_UnitTestCase { 
    5858                /* @var WP_Rewrite $wp_rewrite */
    5959                global $wp_rewrite;
    6060
    61                 $taxonomy        = rand_str();
     61                $taxonomy        = 'taxonomy';
    6262                $taxonomy_object = new WP_Taxonomy(
    6363                        $taxonomy,
    6464                        'post',
    class Tests_WP_Taxonomy extends WP_UnitTestCase { 
    7979        }
    8080
    8181        public function test_adds_ajax_callback() {
    82                 $taxonomy        = rand_str();
     82                $taxonomy        = 'taxonomy';
    8383                $taxonomy_object = new WP_Taxonomy(
    8484                        $taxonomy,
    8585                        'post',
  • tests/phpunit/tests/theme.php

    diff --git a/tests/phpunit/tests/theme.php b/tests/phpunit/tests/theme.php
    index 62cadb62b0..2720eebdde 100644
    a b class Tests_Theme extends WP_UnitTestCase { 
    298298                                // get_query_template()
    299299
    300300                                // Template file that doesn't exist.
    301                                 $this->assertSame( '', get_query_template( rand_str() ) );
     301                                $this->assertSame( '', get_query_template( 'foobar' ) );
    302302
    303303                                // Template files that do exist.
    304304                                /*
    class Tests_Theme extends WP_UnitTestCase { 
    332332
    333333        function test_switch_theme_bogus() {
    334334                // Try switching to a theme that doesn't exist.
    335                 $template = rand_str();
    336                 $style    = rand_str();
     335                $template = 'some_template';
     336                $style    = 'some_style';
    337337                update_option( 'template', $template );
    338338                update_option( 'stylesheet', $style );
    339339
  • tests/phpunit/tests/user.php

    diff --git a/tests/phpunit/tests/user.php b/tests/phpunit/tests/user.php
    index c7a04779cd..62ac00dd77 100644
    a b class Tests_User extends WP_UnitTestCase { 
    9393
    9494        // Simple get/set tests for user_option functions.
    9595        function test_user_option() {
    96                 $key = rand_str();
    97                 $val = rand_str();
     96                $key = 'foo';
     97                $val = 'bar';
    9898
    9999                // Get an option that doesn't exist.
    100100                $this->assertFalse( get_user_option( $key, self::$author_id ) );
    class Tests_User extends WP_UnitTestCase { 
    104104                $this->assertSame( $val, get_user_option( $key, self::$author_id ) );
    105105
    106106                // Change and get again.
    107                 $val2 = rand_str();
     107                $val2 = 'baz';
    108108                update_user_option( self::$author_id, $key, $val2 );
    109109                $this->assertSame( $val2, get_user_option( $key, self::$author_id ) );
    110110        }
    class Tests_User extends WP_UnitTestCase { 
    135135                // Delete by key AND value.
    136136                update_user_meta( self::$author_id, $key, $val );
    137137                // Incorrect key: key still exists.
    138                 delete_user_meta( self::$author_id, $key, rand_str() );
     138                delete_user_meta( self::$author_id, $key, 'foo' );
    139139                $this->assertSame( $val, get_user_meta( self::$author_id, $key, true ) );
    140140                // Correct key: deleted.
    141141                delete_user_meta( self::$author_id, $key, $val );
    class Tests_User extends WP_UnitTestCase { 
    149149        function test_usermeta_array() {
    150150                // Some values to set.
    151151                $vals = array(
    152                         rand_str() => 'val-' . rand_str(),
    153                         rand_str() => 'val-' . rand_str(),
    154                         rand_str() => 'val-' . rand_str(),
     152                        'key0' => 'val0',
     153                        'key1' => 'val1',
     154                        'key2' => 'val2',
    155155                );
    156156
    157157                // There is already some stuff in the array.
    class Tests_User extends WP_UnitTestCase { 
    475475                $post = array(
    476476                        'post_author'  => self::$author_id,
    477477                        'post_status'  => 'publish',
    478                         'post_content' => rand_str(),
    479                         'post_title'   => rand_str(),
     478                        'post_content' => 'content',
     479                        'post_title'   => 'title',
    480480                        'post_type'    => 'post',
    481481                );
    482482
    class Tests_User extends WP_UnitTestCase { 
    636636        function test_user_meta_error() {
    637637                $id1 = wp_insert_user(
    638638                        array(
    639                                 'user_login' => rand_str(),
     639                                'user_login' => 'taco_burrito',
    640640                                'user_pass'  => 'password',
    641641                                'user_email' => 'taco@burrito.com',
    642642                        )
    class Tests_User extends WP_UnitTestCase { 
    645645
    646646                $id2 = wp_insert_user(
    647647                        array(
    648                                 'user_login' => rand_str(),
     648                                'user_login' => 'taco_burrito2',
    649649                                'user_pass'  => 'password',
    650650                                'user_email' => 'taco@burrito.com',
    651651                        )
    class Tests_User extends WP_UnitTestCase { 
    826826         */
    827827        public function test_wp_insert_user_should_not_wipe_existing_password() {
    828828                $user_details = array(
    829                         'user_login' => rand_str(),
     829                        'user_login' => 'jonsnow',
    830830                        'user_pass'  => 'password',
    831                         'user_email' => rand_str() . '@example.com',
     831                        'user_email' => 'jonsnow@example.com',
    832832                );
    833833
    834834                $user_id = wp_insert_user( $user_details );
  • tests/phpunit/tests/user/author.php

    diff --git a/tests/phpunit/tests/user/author.php b/tests/phpunit/tests/user/author.php
    index 1dd92a486d..4828bf7d49 100644
    a b class Tests_User_Author_Template extends WP_UnitTestCase { 
    2626                        array(
    2727                                'post_author'  => self::$author_id,
    2828                                'post_status'  => 'publish',
    29                                 'post_content' => rand_str(),
    30                                 'post_title'   => rand_str(),
     29                                'post_content' => 'content',
     30                                'post_title'   => 'title',
    3131                                'post_type'    => 'post',
    3232                        )
    3333                );
  • tests/phpunit/tests/xmlrpc/wp/editProfile.php

    diff --git a/tests/phpunit/tests/xmlrpc/wp/editProfile.php b/tests/phpunit/tests/xmlrpc/wp/editProfile.php
    index 570de27220..5a69f82823 100644
    a b class Tests_XMLRPC_wp_editProfile extends WP_XMLRPC_UnitTestCase { 
    1616                $subscriber_id = $this->make_user_by_role( 'subscriber' );
    1717
    1818                $new_data = array(
    19                         'first_name'   => rand_str(),
    20                         'last_name'    => rand_str(),
     19                        'first_name'   => 'firstname',
     20                        'last_name'    => 'lastname',
    2121                        'url'          => 'http://www.example.org/subscriber',
    22                         'display_name' => rand_str(),
    23                         'nickname'     => rand_str(),
    24                         'nicename'     => rand_str(),
    25                         'bio'          => rand_str( 200 ),
     22                        'display_name' => 'displayname',
     23                        'nickname'     => 'nickname',
     24                        'nicename'     => 'nicename',
     25                        'bio'          => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
    2626                );
    2727                $result   = $this->myxmlrpcserver->wp_editProfile( array( 1, 'subscriber', 'subscriber', $new_data ) );
    2828                $this->assertNotIXRError( $result );
  • tests/phpunit/tests/xmlrpc/wp/getComment.php

    diff --git a/tests/phpunit/tests/xmlrpc/wp/getComment.php b/tests/phpunit/tests/xmlrpc/wp/getComment.php
    index 1f9b7cd9f5..cfc3a86b29 100644
    a b class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase { 
    1818                        'comment_author'       => 'Test commenter',
    1919                        'comment_author_url'   => 'http://example.com/',
    2020                        'comment_author_email' => 'example@example.com',
    21                         'comment_content'      => rand_str( 100 ),
     21                        'comment_content'      => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
    2222                );
    2323                self::$parent_comment_id   = wp_insert_comment( self::$parent_comment_data );
    2424
    class Tests_XMLRPC_wp_getComment extends WP_XMLRPC_UnitTestCase { 
    2828                        'comment_author_url'   => 'http://example.org/',
    2929                        'comment_author_email' => 'example@example.org',
    3030                        'comment_parent'       => self::$parent_comment_id,
    31                         'comment_content'      => rand_str( 100 ),
     31                        'comment_content'      => 'Duis non neque cursus, commodo massa in, bibendum nisl.',
    3232                );
    3333                self::$child_comment_id   = wp_insert_comment( self::$child_comment_data );
    3434        }
  • tests/phpunit/tests/xmlrpc/wp/getPost.php

    diff --git a/tests/phpunit/tests/xmlrpc/wp/getPost.php b/tests/phpunit/tests/xmlrpc/wp/getPost.php
    index 1480543b43..280d6aaea7 100644
    a b class Tests_XMLRPC_wp_getPost extends WP_XMLRPC_UnitTestCase { 
    1414
    1515                $this->post_date_ts            = strtotime( '+1 day' );
    1616                $this->post_data               = array(
    17                         'post_title'   => rand_str(),
    18                         'post_content' => rand_str( 2000 ),
    19                         'post_excerpt' => rand_str( 100 ),
     17                        'post_title'   => 'Post Title',
     18                        'post_content' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
     19                        'post_excerpt' => 'Post Excerpt',
    2020                        'post_author'  => $this->make_user_by_role( 'author' ),
    2121                        'post_date'    => date_format( date_create( "@{$this->post_date_ts}" ), 'Y-m-d H:i:s' ),
    2222                );
  • tests/phpunit/tests/xmlrpc/wp/newComment.php

    diff --git a/tests/phpunit/tests/xmlrpc/wp/newComment.php b/tests/phpunit/tests/xmlrpc/wp/newComment.php
    index fb4ebca568..d3d426125d 100644
    a b class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { 
    5555                                'administrator',
    5656                                self::$posts['publish']->ID,
    5757                                array(
    58                                         'content' => rand_str( 100 ),
     58                                        'content' => 'Content',
    5959                                ),
    6060                        )
    6161                );
    class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { 
    155155                                'administrator',
    156156                                $post->ID,
    157157                                array(
    158                                         'content' => rand_str( 100 ),
     158                                        'content' => 'Content',
    159159                                ),
    160160                        )
    161161                );
    class Tests_XMLRPC_wp_newComment extends WP_XMLRPC_UnitTestCase { 
    171171                        'administrator',
    172172                        self::$posts['publish']->ID,
    173173                        array(
    174                                 'content' => rand_str( 100 ),
     174                                'content' => 'Content',
    175175                        ),
    176176                );
    177177