Changeset 38382
- Timestamp:
- 08/26/2016 08:21:30 PM (9 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/actions.php
r38251 r38382 145 145 146 146 function test_did_action() { 147 $tag1 = rand_str();148 $tag2 = rand_str();147 $tag1 = 'action1'; 148 $tag2 = 'action2'; 149 149 150 150 // do action tag1 but not tag2 -
trunk/tests/phpunit/tests/admin/includesScreen.php
r36089 r38382 187 187 */ 188 188 function test_help_tabs_priority() { 189 $tab_1 = rand_str();189 $tab_1 = 'tab1'; 190 190 $tab_1_args = array( 191 191 'title' => 'Help!', … … 196 196 ); 197 197 198 $tab_2 = rand_str();198 $tab_2 = 'tab2'; 199 199 $tab_2_args = array( 200 200 'title' => 'Help!', … … 204 204 'priority' => 2, 205 205 ); 206 $tab_3 = rand_str();206 $tab_3 = 'tab3'; 207 207 $tab_3_args = array( 208 208 'title' => 'help!', … … 212 212 'priority' => 40, 213 213 ); 214 $tab_4 = rand_str();214 $tab_4 = 'tab4'; 215 215 $tab_4_args = array( 216 216 'title' => 'help!', -
trunk/tests/phpunit/tests/cron.php
r31622 r38382 40 40 function test_schedule_event_single_args() { 41 41 // schedule an event with arguments and make sure it's returned by wp_next_scheduled 42 $hook = rand_str();43 $timestamp = strtotime('+1 hour'); 44 $args = array( rand_str());42 $hook = 'event'; 43 $timestamp = strtotime('+1 hour'); 44 $args = array('foo'); 45 45 46 46 wp_schedule_single_event( $timestamp, $hook, $args ); … … 49 49 // these don't match so return nothing 50 50 $this->assertEquals( false, wp_next_scheduled($hook) ); 51 $this->assertEquals( false, wp_next_scheduled($hook, array( rand_str())) );51 $this->assertEquals( false, wp_next_scheduled($hook, array('bar')) ); 52 52 53 53 // it's a non recurring event … … 70 70 function test_schedule_event_args() { 71 71 // schedule an event and make sure it's returned by wp_next_scheduled 72 $hook = rand_str();72 $hook = 'event'; 73 73 $timestamp = strtotime('+1 hour'); 74 74 $recur = 'hourly'; 75 $args = array( rand_str());75 $args = array('foo'); 76 76 77 77 wp_schedule_event( $timestamp, 'hourly', $hook, $args ); … … 80 80 // these don't match so return nothing 81 81 $this->assertEquals( false, wp_next_scheduled($hook) ); 82 $this->assertEquals( false, wp_next_scheduled($hook, array( rand_str())) );82 $this->assertEquals( false, wp_next_scheduled($hook, array('bar')) ); 83 83 84 84 $this->assertEquals( $recur, wp_get_schedule($hook, $args) ); -
trunk/tests/phpunit/tests/db/charset.php
r37320 r38382 544 544 545 545 $vars = array(); 546 foreach( $this->table_and_column_defs as $ value ) {547 $this_table_name = $table_name . '_' . rand_str( 5 );546 foreach( $this->table_and_column_defs as $i => $value ) { 547 $this_table_name = $table_name . '_' . $i; 548 548 $drop = "DROP TABLE IF EXISTS $this_table_name"; 549 549 $create = "CREATE TABLE $this_table_name {$value['definition']}"; … … 584 584 585 585 $vars = array(); 586 foreach( $this->table_and_column_defs as $ value ) {587 $this_table_name = $table_name . '_' . rand_str( 5 );586 foreach( $this->table_and_column_defs as $i => $value ) { 587 $this_table_name = $table_name . '_' . $i; 588 588 $drop = "DROP TABLE IF EXISTS $this_table_name"; 589 589 $create = "CREATE TABLE $this_table_name {$value['definition']}"; … … 688 688 ); 689 689 690 foreach( $data as &$value ) {691 $this_table_name = $table_name . '_' . rand_str( 5 );690 foreach( $data as $i => &$value ) { 691 $this_table_name = $table_name . '_' . $i; 692 692 693 693 $value[0] = "CREATE TABLE $this_table_name {$value[0]}"; … … 802 802 ); 803 803 804 foreach( $data as &$value ) {805 $this_table_name = $table_name . '_' . rand_str( 5 );804 foreach( $data as $i => &$value ) { 805 $this_table_name = $table_name . '_' . $i; 806 806 807 807 $value[0] = "CREATE TABLE $this_table_name {$value[0]}"; -
trunk/tests/phpunit/tests/option/option.php
r31640 r38382 11 11 12 12 function test_the_basics() { 13 $key = rand_str();14 $key2 = rand_str();15 $value = rand_str();16 $value2 = rand_str();13 $key = 'key1'; 14 $key2 = 'key2'; 15 $value = 'value1'; 16 $value2 = 'value2'; 17 17 18 18 $this->assertFalse( get_option( 'doesnotexist' ) ); … … 36 36 37 37 function test_default_filter() { 38 $ random = rand_str();38 $value = 'value'; 39 39 40 40 $this->assertFalse( get_option( 'doesnotexist' ) ); … … 49 49 50 50 // Once the option exists, the $default arg and the default filter are ignored. 51 add_option( 'doesnotexist', $ random);52 $this->assertEquals( $ random, get_option( 'doesnotexist', 'foo' ) );51 add_option( 'doesnotexist', $value ); 52 $this->assertEquals( $value, get_option( 'doesnotexist', 'foo' ) ); 53 53 add_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) ); 54 $this->assertEquals( $ random, get_option( 'doesnotexist', 'foo' ) );54 $this->assertEquals( $value, get_option( 'doesnotexist', 'foo' ) ); 55 55 remove_filter( 'default_option_doesnotexist', array( $this, '__return_foo' ) ); 56 56 -
trunk/tests/phpunit/tests/option/siteOption.php
r34766 r38382 93 93 94 94 function test_update_site_option_returns_true_for_new_value() { 95 $key = rand_str();96 $value = rand_str();97 $new_value = rand_str();95 $key = 'key'; 96 $value = 'value1'; 97 $new_value = 'value2'; 98 98 add_site_option( $key, $value ); 99 99 $this->assertTrue( update_site_option( $key, $new_value ) ); -
trunk/tests/phpunit/tests/option/siteTransient.php
r37223 r38382 15 15 16 16 function test_the_basics() { 17 $key = rand_str();18 $value = rand_str();19 $value2 = rand_str();17 $key = 'key1'; 18 $value = 'value1'; 19 $value2 = 'value2'; 20 20 21 21 $this->assertFalse( get_site_transient( 'doesnotexist' ) ); -
trunk/tests/phpunit/tests/option/transient.php
r34828 r38382 15 15 16 16 function test_the_basics() { 17 $key = rand_str();18 $value = rand_str();19 $value2 = rand_str();17 $key = 'key1'; 18 $value = 'value1'; 19 $value2 = 'value2'; 20 20 21 21 $this->assertFalse( get_transient( 'doesnotexist' ) ); -
trunk/tests/phpunit/tests/query/results.php
r36138 r38382 457 457 */ 458 458 function test_query_author_vars() { 459 $author_1 = self::factory()->user->create( array( 'user_login' => 'a dmin1', 'user_pass' => rand_str(), 'role' => 'author' ) );460 $post_1 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) );461 462 $author_2 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );463 $post_2 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) );464 465 $author_3 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );466 $post_3 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) );467 468 $author_4 = self::factory()->user->create( array( 'user_login' => rand_str(), 'user_pass' => rand_str(), 'role' => 'author' ) );469 $post_4 = self::factory()->post->create( array( 'post_title' => rand_str(), 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) );459 $author_1 = self::factory()->user->create( array( 'user_login' => 'author1', 'role' => 'author' ) ); 460 $post_1 = self::factory()->post->create( array( 'post_title' => 'Post 1', 'post_author' => $author_1, 'post_date' => '2007-01-01 00:00:00' ) ); 461 462 $author_2 = self::factory()->user->create( array( 'user_login' => 'author2', 'role' => 'author' ) ); 463 $post_2 = self::factory()->post->create( array( 'post_title' => 'Post 2', 'post_author' => $author_2, 'post_date' => '2007-01-01 00:00:00' ) ); 464 465 $author_3 = self::factory()->user->create( array( 'user_login' => 'author3', 'role' => 'author' ) ); 466 $post_3 = self::factory()->post->create( array( 'post_title' => 'Post 3', 'post_author' => $author_3, 'post_date' => '2007-01-01 00:00:00' ) ); 467 468 $author_4 = self::factory()->user->create( array( 'user_login' => 'author4', 'role' => 'author' ) ); 469 $post_4 = self::factory()->post->create( array( 'post_title' => 'Post 4', 'post_author' => $author_4, 'post_date' => '2007-01-01 00:00:00' ) ); 470 470 471 471 $posts = $this->q->query( array( … … 550 550 551 551 $posts = $this->q->query( array( 552 'author_name' => 'a dmin1',552 'author_name' => 'author1', 553 553 'post__in' => array( $post_1, $post_2, $post_3, $post_4 ) 554 554 ) ); -
trunk/tests/phpunit/tests/term/getTerms.php
r38337 r38382 2315 2315 protected function set_up_three_posts_and_tags() { 2316 2316 $posts = self::factory()->post->create_many( 3, array( 'post_type' => 'post' ) ); 2317 foreach ( $posts as $ post ) {2318 wp_set_object_terms( $post, rand_str(), 'post_tag' );2317 foreach ( $posts as $i => $post ) { 2318 wp_set_object_terms( $post, "term_{$i}", 'post_tag' ); 2319 2319 } 2320 2320 -
trunk/tests/phpunit/tests/term/wpInsertTerm.php
r37641 r38382 11 11 // insert one term into every post taxonomy 12 12 // otherwise term_ids and term_taxonomy_ids might be identical, which could mask bugs 13 $term = rand_str();13 $term = 'seed_term'; 14 14 foreach(get_object_taxonomies('post') as $tax) 15 15 wp_insert_term( $term, $tax ); … … 21 21 22 22 // a new unused term 23 $term = rand_str();23 $term = 'term'; 24 24 $this->assertNull( term_exists($term) ); 25 25 -
trunk/tests/phpunit/tests/term/wpSetObjectTerms.php
r37649 r38382 111 111 $terms = array(); 112 112 for ($i=0; $i<3; $i++ ) { 113 $term = rand_str();113 $term = "term_{$i}"; 114 114 $result = wp_insert_term( $term, $this->taxonomy ); 115 115 $this->assertInternalType( 'array', $result ); … … 246 246 $terms_1 = array(); 247 247 for ($i=0; $i<3; $i++ ) { 248 $term = rand_str();248 $term = "term_{$i}"; 249 249 $result = wp_insert_term( $term, $this->taxonomy ); 250 250 $this->assertInternalType( 'array', $result ); … … 256 256 $terms_2[0] = $terms_1[1]; 257 257 258 $term = rand_str();258 $term = 'term'; 259 259 $result = wp_insert_term( $term, $this->taxonomy ); 260 260 $terms_2[1] = $result['term_id']; -
trunk/tests/phpunit/tests/user.php
r38278 r38382 104 104 // simple tests for usermeta functions 105 105 function test_usermeta() { 106 $key = rand_str();107 $val = rand_str();106 $key = 'key'; 107 $val = 'value1'; 108 108 109 109 // get a meta key that doesn't exist … … 115 115 116 116 // change and get again 117 $val2 = rand_str();117 $val2 = 'value2'; 118 118 update_user_meta( self::$author_id, $key, $val2 ); 119 119 $this->assertEquals( $val2, get_user_meta( self::$author_id, $key, true ) ); … … 582 582 function test_user_update_email_error() { 583 583 $id1 = wp_insert_user( array( 584 'user_login' => rand_str(),584 'user_login' => 'blackburn', 585 585 'user_pass' => 'password', 586 586 'user_email' => 'blackburn@battlefield4.com', … … 589 589 590 590 $id2 = wp_insert_user( array( 591 'user_login' => rand_str(),591 'user_login' => 'miller', 592 592 'user_pass' => 'password', 593 593 'user_email' => 'miller@battlefield4.com', -
trunk/tests/phpunit/tests/xmlrpc/wp/getPosts.php
r35242 r38382 137 137 $this->make_user_by_role( 'editor' ); 138 138 139 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'First: ' . rand_str()) );140 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Second: ' . rand_str()) );139 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'First: Hello, World!' ) ); 140 $post_ids[] = self::factory()->post->create( array( 'post_title' => 'Second: Hello, World!' ) ); 141 141 142 142 // Search for none of them 143 $filter = array( 's' => rand_str());143 $filter = array( 's' => 'Third' ); 144 144 $results = $this->myxmlrpcserver->wp_getPosts( array( 1, 'editor', 'editor', $filter ) ); 145 145 $this->assertNotInstanceOf( 'IXR_Error', $results ); -
trunk/tests/phpunit/tests/xmlrpc/wp/getTerms.php
r38078 r38382 67 67 register_taxonomy( $tax_name, 'post' ); 68 68 for( $i = 0; $i < $num_terms; $i++ ) 69 wp_insert_term( rand_str( 10 ), $tax_name );69 wp_insert_term( "term_{$i}", $tax_name ); 70 70 71 71 -
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r36163 r38382 234 234 $this->make_user_by_role( 'editor' ); 235 235 236 $tag1 = wp_create_tag ( rand_str( 30 ));236 $tag1 = wp_create_tag( 'tag1' ); 237 237 $this->assertInternalType( 'array', $tag1 ); 238 $tag2 = wp_create_tag ( rand_str( 30 ));238 $tag2 = wp_create_tag( 'tag2' ); 239 239 $this->assertInternalType( 'array', $tag2 ); 240 $tag3 = wp_create_tag ( rand_str( 30 ));240 $tag3 = wp_create_tag( 'tag3' ); 241 241 $this->assertInternalType( 'array', $tag3 ); 242 242 … … 259 259 $this->make_user_by_role( 'editor' ); 260 260 261 $ambiguous_name = rand_str( 30 );261 $ambiguous_name = 'foo'; 262 262 $parent_cat = wp_create_category( $ambiguous_name ); 263 263 $child_cat = wp_create_category( $ambiguous_name, $parent_cat ); 264 264 265 $cat1_name = rand_str( 30 );265 $cat1_name = 'cat1'; 266 266 $cat1 = wp_create_category( $cat1_name, $parent_cat ); 267 $cat2_name = rand_str( 30 );267 $cat2_name = 'cat2'; 268 268 269 269 // first a post with valid categories; one that already exists and one to be created
Note: See TracChangeset
for help on using the changeset viewer.