diff --git a/tests/phpunit/tests/actions.php b/tests/phpunit/tests/actions.php index 0f2789a87a..33af45324f 100644 --- a/tests/phpunit/tests/actions.php +++ b/tests/phpunit/tests/actions.php @@ -9,7 +9,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_simple_action() { $a = new MockAction(); - $tag = 'test_action'; + $tag = __FUNCTION__; add_action($tag, array(&$a, 'action')); do_action($tag); @@ -26,7 +26,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_remove_action() { $a = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; add_action($tag, array(&$a, 'action')); do_action($tag); @@ -44,8 +44,8 @@ class Tests_Actions extends WP_UnitTestCase { } function test_has_action() { - $tag = rand_str(); - $func = rand_str(); + $tag = __FUNCTION__; + $func = __FUNCTION__ . '_func'; $this->assertFalse( has_action($tag, $func) ); $this->assertFalse( has_action($tag) ); @@ -61,7 +61,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_multiple_actions() { $a1 = new MockAction(); $a2 = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; // add both actions to the hook add_action($tag, array(&$a1, 'action')); @@ -76,8 +76,8 @@ class Tests_Actions extends WP_UnitTestCase { function test_action_args_1() { $a = new MockAction(); - $tag = rand_str(); - $val = rand_str(); + $tag = __FUNCTION__; + $val = __FUNCTION__ . '_val'; add_action($tag, array(&$a, 'action')); // call the action with a single argument @@ -92,9 +92,9 @@ class Tests_Actions extends WP_UnitTestCase { function test_action_args_2() { $a1 = new MockAction(); $a2 = new MockAction(); - $tag = rand_str(); - $val1 = rand_str(); - $val2 = rand_str(); + $tag = __FUNCTION__; + $val1 = __FUNCTION__ . '_val1'; + $val2 = __FUNCTION__ . '_val2'; // a1 accepts two arguments, a2 doesn't add_action($tag, array(&$a1, 'action'), 10, 2); @@ -125,9 +125,9 @@ class Tests_Actions extends WP_UnitTestCase { $a1 = new MockAction(); $a2 = new MockAction(); $a3 = new MockAction(); - $tag = rand_str(); - $val1 = rand_str(); - $val2 = rand_str(); + $tag = __FUNCTION__; + $val1 = __FUNCTION__ . '_val1'; + $val2 = __FUNCTION__ . '_val2'; // a1 accepts two arguments, a2 doesn't, a3 accepts two arguments add_action( $tag, array( &$a1, 'action' ), 10, 2 ); @@ -155,7 +155,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_action_priority() { $a = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; add_action($tag, array(&$a, 'action'), 10); add_action($tag, array(&$a, 'action2'), 9); @@ -204,8 +204,8 @@ class Tests_Actions extends WP_UnitTestCase { function test_all_action() { $a = new MockAction(); - $tag1 = rand_str(); - $tag2 = rand_str(); + $tag1 = __FUNCTION__ . '_1'; + $tag2 = __FUNCTION__ . '_2'; // add an 'all' action add_action('all', array(&$a, 'action')); @@ -228,7 +228,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_remove_all_action() { $a = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; add_action('all', array(&$a, 'action')); $this->assertEquals(10, has_filter('all', array(&$a, 'action'))); @@ -249,7 +249,7 @@ class Tests_Actions extends WP_UnitTestCase { function test_action_ref_array() { $obj = new stdClass(); $a = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; add_action($tag, array(&$a, 'action')); @@ -268,17 +268,17 @@ class Tests_Actions extends WP_UnitTestCase { function test_action_keyed_array() { $a = new MockAction(); - $tag = rand_str(); + $tag = __FUNCTION__; add_action($tag, array(&$a, 'action')); - $context = array( rand_str() => rand_str() ); + $context = array( 'key1' => 'val1' ); do_action($tag, $context); $args = $a->get_args(); $this->assertSame($args[0][0], $context); - $context2 = array( rand_str() => rand_str(), rand_str() => rand_str() ); + $context2 = array( 'key2' => 'val2', 'key3' => 'val3' ); do_action($tag, $context2); $args = $a->get_args(); @@ -300,7 +300,7 @@ class Tests_Actions extends WP_UnitTestCase { * @ticket 17817 */ function test_action_recursion() { - $tag = rand_str(); + $tag = __FUNCTION__; $a = new MockAction(); $b = new MockAction(); @@ -327,7 +327,7 @@ class Tests_Actions extends WP_UnitTestCase { * @ticket 17817 */ function test_action_callback_manipulation_while_running() { - $tag = rand_str(); + $tag = __FUNCTION__; $a = new MockAction(); $b = new MockAction(); $c = new MockAction(); @@ -362,7 +362,7 @@ class Tests_Actions extends WP_UnitTestCase { * https://core.trac.wordpress.org/ticket/17817#comment:52 */ function test_remove_anonymous_callback() { - $tag = rand_str(); + $tag = __FUNCTION__; $a = new MockAction(); add_action( $tag, array( $a, 'action' ), 12, 1 ); $this->assertTrue( has_action( $tag ) ); @@ -396,7 +396,7 @@ class Tests_Actions extends WP_UnitTestCase { */ function test_array_access_of_wp_filter_global() { global $wp_filter; - $tag = rand_str(); + $tag = __FUNCTION__; add_action( $tag, '__return_null', 11, 1 ); diff --git a/tests/phpunit/tests/actions/closures.php b/tests/phpunit/tests/actions/closures.php index 4dd3d5c1e3..7715fb082e 100644 --- a/tests/phpunit/tests/actions/closures.php +++ b/tests/phpunit/tests/actions/closures.php @@ -17,7 +17,7 @@ class Tests_Actions_Closures extends WP_UnitTestCase { $this->assertSame( 10, has_action($tag, $closure) ); - $context = array( rand_str(), rand_str() ); + $context = array( 'val1', 'val2' ); do_action($tag, $context[0], $context[1]); $this->assertSame($GLOBALS[$context[0]], $context[1]); diff --git a/tests/phpunit/tests/admin/includesScreen.php b/tests/phpunit/tests/admin/includesScreen.php index 317be9bac0..f60e0b8f8b 100644 --- a/tests/phpunit/tests/admin/includesScreen.php +++ b/tests/phpunit/tests/admin/includesScreen.php @@ -154,7 +154,7 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase { } function test_help_tabs() { - $tab = rand_str(); + $tab = __FUNCTION__; $tab_args = array( 'id' => $tab, 'title' => 'Help!', @@ -278,7 +278,7 @@ class Tests_Admin_includesScreen extends WP_UnitTestCase { * @ticket 25799 */ function test_options() { - $option = rand_str(); + $option = __FUNCTION__; $option_args = array( 'label' => 'Option', 'default' => 10, diff --git a/tests/phpunit/tests/cache.php b/tests/phpunit/tests/cache.php index df799e280d..751d6273f1 100644 --- a/tests/phpunit/tests/cache.php +++ b/tests/phpunit/tests/cache.php @@ -27,19 +27,19 @@ class Tests_Cache extends WP_UnitTestCase { } function test_miss() { - $this->assertEquals(NULL, $this->cache->get(rand_str())); + $this->assertEquals( NULL, $this->cache->get( 'test_miss' ) ); } function test_add_get() { - $key = rand_str(); - $val = rand_str(); + $key = __FUNCTION__; + $val = 'val'; $this->cache->add($key, $val); $this->assertEquals($val, $this->cache->get($key)); } function test_add_get_0() { - $key = rand_str(); + $key = __FUNCTION__; $val = 0; // you can store zero in the cache @@ -48,7 +48,7 @@ class Tests_Cache extends WP_UnitTestCase { } function test_add_get_null() { - $key = rand_str(); + $key = __FUNCTION__; $val = null; $this->assertTrue( $this->cache->add($key, $val) ); @@ -57,9 +57,9 @@ class Tests_Cache extends WP_UnitTestCase { } function test_add() { - $key = rand_str(); - $val1 = rand_str(); - $val2 = rand_str(); + $key = __FUNCTION__; + $val1 = 'val1'; + $val2 = 'val2'; // add $key to the cache $this->assertTrue($this->cache->add($key, $val1)); @@ -70,9 +70,9 @@ class Tests_Cache extends WP_UnitTestCase { } function test_replace() { - $key = rand_str(); - $val = rand_str(); - $val2 = rand_str(); + $key = __FUNCTION__; + $val = 'val1'; + $val2 = 'val2'; // memcached rejects replace() if the key does not exist $this->assertFalse($this->cache->replace($key, $val)); @@ -84,9 +84,9 @@ class Tests_Cache extends WP_UnitTestCase { } function test_set() { - $key = rand_str(); - $val1 = rand_str(); - $val2 = rand_str(); + $key = __FUNCTION__; + $val1 = 'val1'; + $val2 = 'val2'; // memcached accepts set() if the key does not exist $this->assertTrue($this->cache->set($key, $val1)); @@ -102,8 +102,8 @@ class Tests_Cache extends WP_UnitTestCase { if ( $_wp_using_ext_object_cache ) return; - $key = rand_str(); - $val = rand_str(); + $key = __FUNCTION__; + $val = 'val'; $this->cache->add($key, $val); // item is visible to both cache objects @@ -115,7 +115,7 @@ class Tests_Cache extends WP_UnitTestCase { // Make sure objects are cloned going to and from the cache function test_object_refs() { - $key = rand_str(); + $key = __FUNCTION__ . '_1'; $object_a = new stdClass; $object_a->foo = 'alpha'; $this->cache->set( $key, $object_a ); @@ -125,7 +125,7 @@ class Tests_Cache extends WP_UnitTestCase { $object_b->foo = 'charlie'; $this->assertEquals( 'bravo', $object_a->foo ); - $key = rand_str(); + $key = __FUNCTION__ . '_2'; $object_a = new stdClass; $object_a->foo = 'alpha'; $this->cache->add( $key, $object_a ); @@ -137,7 +137,7 @@ class Tests_Cache extends WP_UnitTestCase { } function test_incr() { - $key = rand_str(); + $key = __FUNCTION__; $this->assertFalse( $this->cache->incr( $key ) ); @@ -150,7 +150,7 @@ class Tests_Cache extends WP_UnitTestCase { } function test_wp_cache_incr() { - $key = rand_str(); + $key = __FUNCTION__; $this->assertFalse( wp_cache_incr( $key ) ); @@ -163,7 +163,7 @@ class Tests_Cache extends WP_UnitTestCase { } function test_decr() { - $key = rand_str(); + $key = __FUNCTION__; $this->assertFalse( $this->cache->decr( $key ) ); @@ -183,7 +183,7 @@ class Tests_Cache extends WP_UnitTestCase { * @ticket 21327 */ function test_wp_cache_decr() { - $key = rand_str(); + $key = __FUNCTION__; $this->assertFalse( wp_cache_decr( $key ) ); @@ -200,8 +200,8 @@ class Tests_Cache extends WP_UnitTestCase { } function test_delete() { - $key = rand_str(); - $val = rand_str(); + $key = __FUNCTION__; + $val = 'val'; // Verify set $this->assertTrue( $this->cache->set( $key, $val ) ); @@ -215,8 +215,8 @@ class Tests_Cache extends WP_UnitTestCase { } function test_wp_cache_delete() { - $key = rand_str(); - $val = rand_str(); + $key = __FUNCTION__; + $val = 'val'; // Verify set $this->assertTrue( wp_cache_set( $key, $val ) ); @@ -237,9 +237,9 @@ class Tests_Cache extends WP_UnitTestCase { if ( ! method_exists( $this->cache, 'switch_to_blog' ) ) return; - $key = rand_str(); - $val = rand_str(); - $val2 = rand_str(); + $key = __FUNCTION__; + $val = 'val1'; + $val2 = 'val2'; if ( ! is_multisite() ) { // Single site ingnores switch_to_blog(). diff --git a/tests/phpunit/tests/comment-submission.php b/tests/phpunit/tests/comment-submission.php index 8c42db9318..deeeb90393 100644 --- a/tests/phpunit/tests/comment-submission.php +++ b/tests/phpunit/tests/comment-submission.php @@ -622,7 +622,7 @@ class Tests_Comment_Submission extends WP_UnitTestCase { $data = array( 'comment_post_ID' => $post->ID, - 'comment' => rand_str(), + 'comment' => 'Comment', 'author' => rand_long_str( 255 ), 'email' => 'comment@example.org', ); @@ -642,7 +642,7 @@ class Tests_Comment_Submission extends WP_UnitTestCase { $data = array( 'comment_post_ID' => $post->ID, - 'comment' => rand_str(), + 'comment' => 'Comment', 'author' => 'Comment Author', 'email' => rand_long_str( 90 ) . '@example.com', ); @@ -661,7 +661,7 @@ class Tests_Comment_Submission extends WP_UnitTestCase { $post = self::factory()->post->create_and_get(); $data = array( 'comment_post_ID' => $post->ID, - 'comment' => rand_str(), + 'comment' => 'Comment', 'author' => 'Comment Author', 'email' => 'comment@example.org', 'url' => rand_long_str( 201 ), diff --git a/tests/phpunit/tests/comment.php b/tests/phpunit/tests/comment.php index e3c8081d4e..e0a123ae71 100644 --- a/tests/phpunit/tests/comment.php +++ b/tests/phpunit/tests/comment.php @@ -127,11 +127,11 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_respects_dates() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', 'comment_date' => '2011-01-01 10:00:00', 'comment_date_gmt' => '2011-01-01 10:00:00', ); @@ -150,12 +150,12 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_respects_author_ip() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '192.168.1.1', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $id = wp_new_comment( $data ); @@ -171,12 +171,12 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_respects_author_ip_empty_string() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $id = wp_new_comment( $data ); @@ -192,13 +192,13 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_respects_comment_agent() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $id = wp_new_comment( $data ); @@ -214,13 +214,13 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_should_trim_provided_comment_agent_to_254_chars() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_agent' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X; en-us) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A465 Safari/9537.53 Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16 Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en; rv:1.8.1.4pre) Gecko/20070511 Camino/1.6pre', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $id = wp_new_comment( $data ); @@ -236,13 +236,13 @@ class Tests_Comment extends WP_UnitTestCase { public function test_wp_new_comment_respects_comment_agent_empty_string() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_agent' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $id = wp_new_comment( $data ); @@ -256,7 +256,7 @@ class Tests_Comment extends WP_UnitTestCase { public function test_comment_field_lengths() { $data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', @@ -538,11 +538,11 @@ class Tests_Comment extends WP_UnitTestCase { // Moderators are notified when a new comment is added. $data = array( 'comment_post_ID' => $post, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); wp_new_comment( $data ); @@ -588,11 +588,11 @@ class Tests_Comment extends WP_UnitTestCase { // Post authors are notified when a new comment is added to their post. $data = array( 'comment_post_ID' => $post, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); wp_new_comment( $data ); @@ -638,13 +638,13 @@ class Tests_Comment extends WP_UnitTestCase { $default_data = array( 'comment_post_ID' => self::$post_id, - 'comment_author' => rand_str(), + 'comment_author' => 'Comment Author', 'comment_author_IP' => '192.168.0.1', 'comment_agent' => 'WRONG_AGENT', 'comment_author_url' => '', 'comment_author_email' => '', 'comment_type' => '', - 'comment_content' => rand_str(), + 'comment_content' => 'Comment', ); $comment_id = wp_new_comment( $default_data ); diff --git a/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php b/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php index aa80dcc837..9b988305e8 100644 --- a/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php +++ b/tests/phpunit/tests/comment/getCommentAuthorEmailLink.php @@ -40,9 +40,9 @@ class Tests_Comment_GetCommentAuthorEmailLink extends WP_UnitTestCase { public function test_all_parameters() { unset( $GLOBALS['comment'] ); - $linktext = rand_str( 10 ); - $before = rand_str( 5 ); - $after = rand_str( 6 ); + $linktext = 'linktext'; + $before = 'before'; + $after = 'after'; $comment = self::factory()->comment->create_and_get( array( 'comment_author_email' => $email = 'baz@example.org' ) ); @@ -53,9 +53,9 @@ class Tests_Comment_GetCommentAuthorEmailLink extends WP_UnitTestCase { } public function test_all_parameters_with_global_comment() { - $linktext = rand_str( 10 ); - $before = rand_str( 5 ); - $after = rand_str( 6 ); + $linktext = 'linktext'; + $before = 'before'; + $after = 'after'; $expected = sprintf( '%1$s%2$s%3$s', $before, $linktext, $after ); @@ -63,19 +63,19 @@ class Tests_Comment_GetCommentAuthorEmailLink extends WP_UnitTestCase { } public function test_linktext() { - $expected = sprintf( '%1$s', $linktext = rand_str( 12 ) ); + $expected = sprintf( '%1$s', $linktext = 'linktext' ); $this->assertEquals( $expected, get_comment_author_email_link( $linktext ) ); } public function test_before() { - $expected = sprintf( '%1$sfoo@example.org', $before = rand_str( 5 ) ); + $expected = sprintf( '%1$sfoo@example.org', $before = 'before' ); $this->assertEquals( $expected, get_comment_author_email_link( '', $before ) ); } public function test_after() { - $expected = sprintf( 'foo@example.org%1$s', $after = rand_str( 5 ) ); + $expected = sprintf( 'foo@example.org%1$s', $after = 'after' ); $this->assertEquals( $expected, get_comment_author_email_link( '', '', $after ) ); } diff --git a/tests/phpunit/tests/cron.php b/tests/phpunit/tests/cron.php index ecd60be402..3beac80264 100644 --- a/tests/phpunit/tests/cron.php +++ b/tests/phpunit/tests/cron.php @@ -20,13 +20,13 @@ class Tests_Cron extends WP_UnitTestCase { function test_wp_get_schedule_empty() { // nothing scheduled - $hook = rand_str(); + $hook = __FUNCTION__; $this->assertFalse(wp_get_schedule($hook)); } function test_schedule_event_single() { // schedule an event and make sure it's returned by wp_next_scheduled - $hook = rand_str(); + $hook = __FUNCTION__; $timestamp = strtotime('+1 hour'); wp_schedule_single_event( $timestamp, $hook ); @@ -56,7 +56,7 @@ class Tests_Cron extends WP_UnitTestCase { function test_schedule_event() { // schedule an event and make sure it's returned by wp_next_scheduled - $hook = rand_str(); + $hook = __FUNCTION__; $recur = 'hourly'; $timestamp = strtotime('+1 hour'); @@ -87,7 +87,7 @@ class Tests_Cron extends WP_UnitTestCase { function test_unschedule_event() { // schedule an event and make sure it's returned by wp_next_scheduled - $hook = rand_str(); + $hook = __FUNCTION__; $timestamp = strtotime('+1 hour'); wp_schedule_single_event( $timestamp, $hook ); @@ -99,8 +99,8 @@ class Tests_Cron extends WP_UnitTestCase { } function test_clear_schedule() { - $hook = rand_str(); - $args = array(rand_str()); + $hook = __FUNCTION__; + $args = array( 'arg1' ); // schedule several events with and without arguments wp_schedule_single_event( strtotime('+1 hour'), $hook ); @@ -125,8 +125,8 @@ class Tests_Cron extends WP_UnitTestCase { } function test_clear_schedule_multiple_args() { - $hook = rand_str(); - $args = array(rand_str(), rand_str()); + $hook = __FUNCTION__; + $args = array( 'arg1', 'arg2' ); // schedule several events with and without arguments wp_schedule_single_event( strtotime('+1 hour'), $hook ); @@ -154,10 +154,10 @@ class Tests_Cron extends WP_UnitTestCase { * @ticket 10468 */ function test_clear_schedule_new_args() { - $hook = rand_str(); - $args = array(rand_str()); - $multi_hook = rand_str(); - $multi_args = array(rand_str(), rand_str()); + $hook = __FUNCTION__; + $args = array( 'arg1' ); + $multi_hook = __FUNCTION__ . '_multi'; + $multi_args = array( 'arg2', 'arg3' ); // schedule several events with and without arguments wp_schedule_single_event( strtotime('+1 hour'), $hook ); @@ -194,8 +194,8 @@ class Tests_Cron extends WP_UnitTestCase { */ function test_duplicate_event() { // duplicate events close together should be skipped - $hook = rand_str(); - $args = array(rand_str()); + $hook = __FUNCTION__; + $args = array( 'arg1' ); $ts1 = strtotime('+5 minutes'); $ts2 = strtotime('+3 minutes'); @@ -213,8 +213,8 @@ class Tests_Cron extends WP_UnitTestCase { */ function test_not_duplicate_event() { // duplicate events far apart should work normally - $hook = rand_str(); - $args = array( rand_str() ); + $hook = __FUNCTION__; + $args = array( 'arg1' ); $ts1 = strtotime( '+30 minutes' ); $ts2 = strtotime( '+3 minutes' ); @@ -232,8 +232,8 @@ class Tests_Cron extends WP_UnitTestCase { function test_not_duplicate_event_reversed() { // duplicate events far apart should work normally regardless of order - $hook = rand_str(); - $args = array( rand_str() ); + $hook = __FUNCTION__; + $args = array( 'arg1' ); $ts1 = strtotime( '+3 minutes' ); $ts2 = strtotime( '+30 minutes' ); @@ -274,7 +274,7 @@ class WPTestCronRunning extends _WPEmptyBlog { function test_run_schedule_single() { // schedule an event, run it, and make sure the hook is called - $hook = rand_str(); + $hook = __FUNCTION__; $args = array(rand_str()); $timestamp = strtotime('-1 second'); @@ -300,7 +300,7 @@ class WPTestCronRunning extends _WPEmptyBlog { function test_run_schedule_recurring() { // schedule a recurring event, run it, and make sure the hook is called - $hook = rand_str(); + $hook = __FUNCTION__; $args = array(rand_str()); $timestamp = strtotime('-1 second'); $recur = 'hourly'; diff --git a/tests/phpunit/tests/customize/setting.php b/tests/phpunit/tests/customize/setting.php index 94a3fe8a90..ebc7dfb7b0 100644 --- a/tests/phpunit/tests/customize/setting.php +++ b/tests/phpunit/tests/customize/setting.php @@ -480,7 +480,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase { function test_is_current_blog_previewed() { $type = 'option'; $name = 'blogname'; - $post_value = rand_str(); + $post_value = __FUNCTION__; $this->manager->set_post_value( $name, $post_value ); $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type' ) ); $this->assertFalse( $setting->is_current_blog_previewed() ); @@ -504,7 +504,7 @@ class Tests_WP_Customize_Setting extends WP_UnitTestCase { $type = 'option'; $name = 'blogdescription'; - $post_value = rand_str(); + $post_value = __FUNCTION__; $this->manager->set_post_value( $name, $post_value ); $setting = new WP_Customize_Setting( $this->manager, $name, compact( 'type' ) ); $this->assertFalse( $setting->is_current_blog_previewed() );