Changeset 38762
- Timestamp:
- 10/09/2016 01:11:14 AM (9 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/file.php
r36882 r38762 85 85 function test_unique_filename_is_valid() { 86 86 // make sure it produces a valid, writable, unique filename 87 $filename = wp_unique_filename( $this->dir, rand_str(). '.txt' );87 $filename = wp_unique_filename( $this->dir, __FUNCTION__ . '.txt' ); 88 88 89 89 $this->assertTrue( $this->is_unique_writable_file($this->dir, $filename) ); … … 94 94 function test_unique_filename_is_unique() { 95 95 // make sure it produces two unique filenames 96 $name = rand_str();96 $name = __FUNCTION__; 97 97 98 98 $filename1 = wp_unique_filename( $this->dir, $name . '.txt' ); … … 109 109 110 110 function test_unique_filename_is_sanitized() { 111 $name = rand_str();111 $name = __FUNCTION__; 112 112 $filename = wp_unique_filename( $this->dir, $name . $this->badchars . '.txt' ); 113 113 … … 121 121 122 122 function test_unique_filename_with_slashes() { 123 $name = rand_str();123 $name = __FUNCTION__; 124 124 // "foo/foo.txt" 125 125 $filename = wp_unique_filename( $this->dir, $name . '/' . $name . '.txt' ); … … 134 134 135 135 function test_unique_filename_multiple_ext() { 136 $name = rand_str();136 $name = __FUNCTION__; 137 137 $filename = wp_unique_filename( $this->dir, $name . '.php.txt' ); 138 138 … … 146 146 147 147 function test_unique_filename_no_ext() { 148 $name = rand_str();148 $name = __FUNCTION__; 149 149 $filename = wp_unique_filename( $this->dir, $name ); 150 150 -
trunk/tests/phpunit/tests/filters.php
r38571 r38762 10 10 function test_simple_filter() { 11 11 $a = new MockAction(); 12 $tag = rand_str();13 $val = rand_str();12 $tag = __FUNCTION__; 13 $val = __FUNCTION__ . '_val'; 14 14 15 15 add_filter($tag, array($a, 'filter')); … … 28 28 function test_remove_filter() { 29 29 $a = new MockAction(); 30 $tag = rand_str();31 $val = rand_str();30 $tag = __FUNCTION__; 31 $val = __FUNCTION__ . '_val'; 32 32 33 33 add_filter($tag, array($a, 'filter')); … … 47 47 48 48 function test_has_filter() { 49 $tag = rand_str();50 $func = rand_str();49 $tag = __FUNCTION__; 50 $func = __FUNCTION__ . '_func'; 51 51 52 52 $this->assertFalse( has_filter($tag, $func) ); … … 64 64 $a1 = new MockAction(); 65 65 $a2 = new MockAction(); 66 $tag = rand_str();67 $val = rand_str();66 $tag = __FUNCTION__; 67 $val = __FUNCTION__ . '_val'; 68 68 69 69 // add both filters to the hook … … 80 80 function test_filter_args_1() { 81 81 $a = new MockAction(); 82 $tag = rand_str();83 $val = rand_str();84 $arg1 = rand_str();82 $tag = __FUNCTION__; 83 $val = __FUNCTION__ . '_val'; 84 $arg1 = __FUNCTION__ . '_arg1'; 85 85 86 86 add_filter($tag, array($a, 'filter'), 10, 2); … … 96 96 $a1 = new MockAction(); 97 97 $a2 = new MockAction(); 98 $tag = rand_str();99 $val = rand_str();100 $arg1 = rand_str();101 $arg2 = rand_str();98 $tag = __FUNCTION__; 99 $val = __FUNCTION__ . '_val'; 100 $arg1 = __FUNCTION__ . '_arg1'; 101 $arg2 = __FUNCTION__ . '_arg2'; 102 102 103 103 // a1 accepts two arguments, a2 doesn't … … 120 120 function test_filter_priority() { 121 121 $a = new MockAction(); 122 $tag = rand_str();123 $val = rand_str();122 $tag = __FUNCTION__; 123 $val = __FUNCTION__ . '_val'; 124 124 125 125 // make two filters with different priorities … … 151 151 function test_all_filter() { 152 152 $a = new MockAction(); 153 $tag1 = rand_str();154 $tag2 = rand_str();155 $val = rand_str();153 $tag1 = __FUNCTION__ . '_1'; 154 $tag2 = __FUNCTION__ . '_2'; 155 $val = __FUNCTION__ . '_val'; 156 156 157 157 // add an 'all' filter … … 175 175 function test_remove_all_filter() { 176 176 $a = new MockAction(); 177 $tag = rand_str();178 $val = rand_str();177 $tag = __FUNCTION__; 178 $val = __FUNCTION__ . '_val'; 179 179 180 180 add_filter('all', array($a, 'filterall')); … … 202 202 function test_remove_all_filters_should_respect_the_priority_argument() { 203 203 $a = new MockAction(); 204 $tag = rand_str();205 $val = rand_str();204 $tag = __FUNCTION__; 205 $val = __FUNCTION__ . '_val'; 206 206 207 207 add_filter( $tag, array( $a, 'filter' ), 12 ); … … 222 222 $obj = new stdClass(); 223 223 $a = new MockAction(); 224 $tag = rand_str();224 $tag = __FUNCTION__; 225 225 226 226 add_action($tag, array($a, 'filter')); … … 242 242 $a = new MockAction(); 243 243 $b = new MockAction(); 244 $tag = rand_str();244 $tag = __FUNCTION__; 245 245 246 246 add_action($tag, array($a, 'filter_append'), 10, 2); … … 275 275 function test_has_filter_after_remove_all_filters() { 276 276 $a = new MockAction(); 277 $tag = rand_str();278 $val = rand_str();277 $tag = __FUNCTION__; 278 $val = __FUNCTION__ . '_val'; 279 279 280 280 // No priority -
trunk/tests/phpunit/tests/general/document-title.php
r36168 r38762 29 29 'post_author' => $this->author_id, 30 30 'post_status' => 'publish', 31 'post_content' => rand_str(),32 31 'post_title' => 'test_title', 33 32 'post_type' => 'post', -
trunk/tests/phpunit/tests/hooks/add_filter.php
r38571 r38762 14 14 $callback = '__return_null'; 15 15 $hook = new WP_Hook(); 16 $tag = rand_str();16 $tag = __FUNCTION__; 17 17 $priority = rand( 1, 100 ); 18 18 $accepted_args = rand( 1, 100 ); … … 29 29 $callback = array( $a, 'action' ); 30 30 $hook = new WP_Hook(); 31 $tag = rand_str();31 $tag = __FUNCTION__; 32 32 $priority = rand( 1, 100 ); 33 33 $accepted_args = rand( 1, 100 ); … … 43 43 $callback = array( 'MockAction', 'action' ); 44 44 $hook = new WP_Hook(); 45 $tag = rand_str();45 $tag = __FUNCTION__; 46 46 $priority = rand( 1, 100 ); 47 47 $accepted_args = rand( 1, 100 ); … … 58 58 $callback_two = '__return_false'; 59 59 $hook = new WP_Hook(); 60 $tag = rand_str();60 $tag = __FUNCTION__; 61 61 $priority = rand( 1, 100 ); 62 62 $accepted_args = rand( 1, 100 ); … … 73 73 $callback_two = '__return_false'; 74 74 $hook = new WP_Hook(); 75 $tag = rand_str();75 $tag = __FUNCTION__; 76 76 $priority = rand( 1, 100 ); 77 77 $accepted_args = rand( 1, 100 ); … … 88 88 $callback = '__return_null'; 89 89 $hook = new WP_Hook(); 90 $tag = rand_str();90 $tag = __FUNCTION__; 91 91 $priority = rand( 1, 100 ); 92 92 $accepted_args = rand( 1, 100 ); … … 102 102 $callback = '__return_null'; 103 103 $hook = new WP_Hook(); 104 $tag = rand_str();104 $tag = __FUNCTION__; 105 105 $priority = rand( 1, 100 ); 106 106 $accepted_args = rand( 1, 100 ); … … 119 119 $c = new MockAction(); 120 120 $hook = new WP_Hook(); 121 $tag = rand_str();121 $tag = __FUNCTION__; 122 122 123 123 $hook->add_filter( $tag, array( $a, 'action' ), 10, 1 ); -
trunk/tests/phpunit/tests/hooks/apply_filters.php
r38571 r38762 12 12 $callback = array( $a, 'filter' ); 13 13 $hook = new WP_Hook(); 14 $tag = rand_str();14 $tag = __FUNCTION__; 15 15 $priority = rand( 1, 100 ); 16 16 $accepted_args = rand( 1, 100 ); 17 $arg = rand_str();17 $arg = __FUNCTION__ . '_arg'; 18 18 19 19 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); … … 29 29 $callback = array( $a, 'filter' ); 30 30 $hook = new WP_Hook(); 31 $tag = rand_str();31 $tag = __FUNCTION__; 32 32 $priority = rand( 1, 100 ); 33 33 $accepted_args = rand( 1, 100 ); 34 $arg = rand_str();34 $arg = __FUNCTION__ . '_arg'; 35 35 36 36 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); -
trunk/tests/phpunit/tests/hooks/do_action.php
r38571 r38762 20 20 $callback = array( $a, 'action' ); 21 21 $hook = new WP_Hook(); 22 $tag = rand_str();22 $tag = __FUNCTION__; 23 23 $priority = rand( 1, 100 ); 24 24 $accepted_args = rand( 1, 100 ); 25 $arg = rand_str();25 $arg = __FUNCTION__ . '_arg'; 26 26 27 27 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); … … 35 35 $callback = array( $a, 'filter' ); 36 36 $hook = new WP_Hook(); 37 $tag = rand_str();37 $tag = __FUNCTION__; 38 38 $priority = rand( 1, 100 ); 39 39 $accepted_args = rand( 1, 100 ); 40 $arg = rand_str();40 $arg = __FUNCTION__ . '_arg'; 41 41 42 42 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); … … 53 53 $callback_two = array( $b, 'filter' ); 54 54 $hook = new WP_Hook(); 55 $tag = rand_str();55 $tag = __FUNCTION__; 56 56 $priority = rand( 1, 100 ); 57 57 $accepted_args = rand( 1, 100 ); 58 $arg = rand_str();58 $arg = __FUNCTION__ . '_arg'; 59 59 60 60 $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); … … 72 72 $callback_two = array( $b, 'filter' ); 73 73 $hook = new WP_Hook(); 74 $tag = rand_str();74 $tag = __FUNCTION__; 75 75 $priority = rand( 1, 100 ); 76 76 $accepted_args = rand( 1, 100 ); 77 $arg = rand_str();77 $arg = __FUNCTION__ . '_arg'; 78 78 79 79 $hook->add_filter( $tag, $callback_one, $priority, $accepted_args ); … … 88 88 $callback = array( $this, '_action_callback' ); 89 89 $hook = new WP_Hook(); 90 $tag = rand_str();90 $tag = __FUNCTION__; 91 91 $priority = rand( 1, 100 ); 92 92 $accepted_args = 0; 93 $arg = rand_str();93 $arg = __FUNCTION__ . '_arg'; 94 94 95 95 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); … … 102 102 $callback = array( $this, '_action_callback' ); 103 103 $hook = new WP_Hook(); 104 $tag = rand_str();104 $tag = __FUNCTION__; 105 105 $priority = rand( 1, 100 ); 106 106 $accepted_args = 1; 107 $arg = rand_str();107 $arg = __FUNCTION__ . '_arg'; 108 108 109 109 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); … … 116 116 $callback = array( $this, '_action_callback' ); 117 117 $hook = new WP_Hook(); 118 $tag = rand_str();118 $tag = __FUNCTION__; 119 119 $priority = rand( 1, 100 ); 120 120 $accepted_args = 1000; 121 $arg = rand_str();121 $arg = __FUNCTION__ . '_arg'; 122 122 123 123 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); -
trunk/tests/phpunit/tests/hooks/do_all_hook.php
r38571 r38762 15 15 $priority = rand( 1, 100 ); 16 16 $accepted_args = rand( 1, 100 ); 17 $arg = rand_str();17 $arg = 'all_arg'; 18 18 19 19 $hook->add_filter( $tag, $callback, $priority, $accepted_args ); -
trunk/tests/phpunit/tests/hooks/has_filter.php
r38571 r38762 11 11 $callback = '__return_null'; 12 12 $hook = new WP_Hook(); 13 $tag = rand_str();13 $tag = __FUNCTION__; 14 14 $priority = rand( 1, 100 ); 15 15 $accepted_args = rand( 1, 100 ); … … 24 24 $callback = array( $a, 'action' ); 25 25 $hook = new WP_Hook(); 26 $tag = rand_str();26 $tag = __FUNCTION__; 27 27 $priority = rand( 1, 100 ); 28 28 $accepted_args = rand( 1, 100 ); … … 36 36 $callback = array( 'MockAction', 'action' ); 37 37 $hook = new WP_Hook(); 38 $tag = rand_str();38 $tag = __FUNCTION__; 39 39 $priority = rand( 1, 100 ); 40 40 $accepted_args = rand( 1, 100 ); … … 48 48 $callback = '__return_null'; 49 49 $hook = new WP_Hook(); 50 $tag = rand_str();50 $tag = __FUNCTION__; 51 51 $priority = rand( 1, 100 ); 52 52 $accepted_args = rand( 1, 100 ); … … 65 65 $callback = '__return_null'; 66 66 $hook = new WP_Hook(); 67 $tag = rand_str();67 $tag = __FUNCTION__; 68 68 69 69 $this->assertFalse( $hook->has_filter( $tag, $callback ) ); … … 73 73 $callback = '__return_null'; 74 74 $hook = new WP_Hook(); 75 $tag = rand_str();75 $tag = __FUNCTION__; 76 76 $priority = rand( 1, 100 ); 77 77 $accepted_args = rand( 1, 100 ); -
trunk/tests/phpunit/tests/hooks/has_filters.php
r38571 r38762 11 11 $callback = '__return_null'; 12 12 $hook = new WP_Hook(); 13 $tag = rand_str();13 $tag = __FUNCTION__; 14 14 $priority = rand( 1, 100 ); 15 15 $accepted_args = rand( 1, 100 ); … … 28 28 $callback = '__return_null'; 29 29 $hook = new WP_Hook(); 30 $tag = rand_str();30 $tag = __FUNCTION__; 31 31 $priority = rand( 1, 100 ); 32 32 $accepted_args = rand( 1, 100 ); … … 40 40 $callback = '__return_null'; 41 41 $hook = new WP_Hook(); 42 $tag = rand_str();42 $tag = __FUNCTION__; 43 43 $priority = rand( 1, 100 ); 44 44 $accepted_args = rand( 1, 100 ); -
trunk/tests/phpunit/tests/hooks/iterator.php
r38571 r38762 12 12 $callback_two = '__return_false'; 13 13 $hook = new WP_Hook(); 14 $tag = rand_str();14 $tag = __FUNCTION__; 15 15 $priority = rand( 1, 100 ); 16 16 $accepted_args = rand( 1, 100 ); -
trunk/tests/phpunit/tests/hooks/preinit_hooks.php
r38571 r38762 9 9 10 10 public function test_array_to_hooks() { 11 $tag1 = rand_str();11 $tag1 = __FUNCTION__ . '_1'; 12 12 $priority1 = rand( 1, 100 ); 13 $tag2 = rand_str();13 $tag2 = __FUNCTION__ . '_2'; 14 14 $priority2 = rand( 1, 100 ); 15 15 $filters = array( -
trunk/tests/phpunit/tests/hooks/remove_all_filters.php
r38571 r38762 11 11 $callback = '__return_null'; 12 12 $hook = new WP_Hook(); 13 $tag = rand_str();13 $tag = __FUNCTION__; 14 14 $priority = rand( 1, 100 ); 15 15 $accepted_args = rand( 1, 100 ); … … 26 26 $callback_two = '__return_false'; 27 27 $hook = new WP_Hook(); 28 $tag = rand_str();28 $tag = __FUNCTION__; 29 29 $priority = rand( 1, 100 ); 30 30 $accepted_args = rand( 1, 100 ); -
trunk/tests/phpunit/tests/hooks/remove_filter.php
r38571 r38762 11 11 $callback = '__return_null'; 12 12 $hook = new WP_Hook(); 13 $tag = rand_str();13 $tag = __FUNCTION__; 14 14 $priority = rand( 1, 100 ); 15 15 $accepted_args = rand( 1, 100 ); … … 25 25 $callback = array( $a, 'action' ); 26 26 $hook = new WP_Hook(); 27 $tag = rand_str();27 $tag = __FUNCTION__; 28 28 $priority = rand( 1, 100 ); 29 29 $accepted_args = rand( 1, 100 ); … … 38 38 $callback = array( 'MockAction', 'action' ); 39 39 $hook = new WP_Hook(); 40 $tag = rand_str();40 $tag = __FUNCTION__; 41 41 $priority = rand( 1, 100 ); 42 42 $accepted_args = rand( 1, 100 ); … … 52 52 $callback_two = '__return_false'; 53 53 $hook = new WP_Hook(); 54 $tag = rand_str();54 $tag = __FUNCTION__; 55 55 $priority = rand( 1, 100 ); 56 56 $accepted_args = rand( 1, 100 ); … … 68 68 $callback_two = '__return_false'; 69 69 $hook = new WP_Hook(); 70 $tag = rand_str();70 $tag = __FUNCTION__; 71 71 $priority = rand( 1, 100 ); 72 72 $accepted_args = rand( 1, 100 ); -
trunk/tests/phpunit/tests/image/functions.php
r38761 r38762 307 307 $file = wp_crop_image( 'https://asdftestblog1.files.wordpress.com/2008/04/canola.jpg', 308 308 0, 0, 100, 100, 100, 100, false, 309 DIR_TESTDATA . '/images/' . rand_str(). '.jpg' );309 DIR_TESTDATA . '/images/' . __FUNCTION__ . '.jpg' ); 310 310 $this->assertNotInstanceOf( 'WP_Error', $file ); 311 311 $this->assertFileExists( $file ); -
trunk/tests/phpunit/tests/link/getPreviewPostLink.php
r37566 r38762 53 53 54 54 public function test_get_preview_post_link_should_return_empty_string_for_non_viewable_post_type() { 55 $post_type = register_post_type( rand_str(12), array(55 $post_type = register_post_type( 'non_viewable_cpt', array( 56 56 'public' => false, 57 57 ) ); -
trunk/tests/phpunit/tests/meta.php
r38699 r38762 162 162 163 163 function test_metadata_slashes() { 164 $key = rand_str();164 $key = __FUNCTION__; 165 165 $value = 'Test\\singleslash'; 166 166 $expected = 'Testsingleslash'; -
trunk/tests/phpunit/tests/multisite/getSpaceUsed.php
r35242 r38762 36 36 37 37 // Upload a file to the new site. 38 $filename = rand_str().'.jpg';39 $contents = rand_str();38 $filename = __FUNCTION__ . '.jpg'; 39 $contents = __FUNCTION__ . '_contents'; 40 40 $file = wp_upload_bits( $filename, null, $contents ); 41 41 … … 72 72 73 73 // Upload a file to the new site. 74 $filename = rand_str().'.jpg';75 $contents = rand_str();74 $filename = __FUNCTION__ . '.jpg'; 75 $contents = __FUNCTION__ . '_contents'; 76 76 wp_upload_bits( $filename, null, $contents ); 77 77 -
trunk/tests/phpunit/tests/multisite/ms-files-rewriting.php
r35242 r38762 62 62 */ 63 63 function test_upload_directories_after_multiple_wpmu_delete_blog_with_ms_files() { 64 $filename = rand_str().'.jpg';65 $contents = rand_str();64 $filename = __FUNCTION__ . '.jpg'; 65 $contents = __FUNCTION__ . '_contents'; 66 66 67 67 // Upload a file to the main site on the network. -
trunk/tests/phpunit/tests/multisite/site.php
r38659 r38762 271 271 */ 272 272 function test_upload_directories_after_multiple_wpmu_delete_blog() { 273 $filename = rand_str().'.jpg';274 $contents = rand_str();273 $filename = __FUNCTION__ . '.jpg'; 274 $contents = __FUNCTION__ . '_contents'; 275 275 276 276 // Upload a file to the main site on the network. -
trunk/tests/phpunit/tests/oembed/WpEmbed.php
r37892 r38762 65 65 66 66 public function test_wp_embed_register_handler() { 67 $handle = rand_str();67 $handle = __FUNCTION__; 68 68 $regex = '#https?://example\.com/embed/([^/]+)#i'; 69 69 $callback = array( $this, '_embed_handler_callback' ); … … 103 103 104 104 public function test_autoembed_should_return_modified_content() { 105 $handle = rand_str();105 $handle = __FUNCTION__; 106 106 $regex = '#https?://example\.com/embed/([^/]+)#i'; 107 107 $callback = array( $this, '_embed_handler_callback' ); -
trunk/tests/phpunit/tests/option/multisite.php
r35242 r38762 26 26 27 27 function test_from_same_site() { 28 $key = rand_str();29 $key2 = rand_str();30 $value = rand_str();31 $value2 = rand_str();28 $key = __FUNCTION__ . '_1'; 29 $key2 = __FUNCTION__ . '_2'; 30 $value = __FUNCTION__ . '_val1'; 31 $value2 = __FUNCTION__ . '_val2'; 32 32 33 33 $this->assertFalse( get_blog_option( 1, 'doesnotexist' ) ); … … 63 63 64 64 function test_from_same_site_with_null_blog_id() { 65 $key = rand_str();66 $key2 = rand_str();67 $value = rand_str();68 $value2 = rand_str();65 $key = __FUNCTION__ . '_1'; 66 $key2 = __FUNCTION__ . '_2'; 67 $value = __FUNCTION__ . '_val1'; 68 $value2 = __FUNCTION__ . '_val2'; 69 69 70 70 $this->assertFalse( get_blog_option( null, 'doesnotexist' ) ); … … 110 110 $this->assertInternalType( 'integer', $blog_id ); 111 111 112 $key = rand_str();113 $key2 = rand_str();114 $value = rand_str();115 $value2 = rand_str();112 $key = __FUNCTION__ . '_key1'; 113 $key2 = __FUNCTION__ . '_key2'; 114 $value = __FUNCTION__ . '_val1'; 115 $value2 = __FUNCTION__ . '_val2'; 116 116 117 117 $this->assertFalse( get_blog_option( $blog_id, 'doesnotexist' ) );
Note: See TracChangeset
for help on using the changeset viewer.