Changeset 1148 in tests
- Timestamp:
- 11/21/2012 03:01:28 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/mock-image-editor.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/admin/includesFile.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/admin/includesPost.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/admin/includesScreen.php
r1073 r1148 81 81 $this->assertFalse( $current_screen->in_admin( 'user' ) ); 82 82 $this->assertFalse( $current_screen->in_admin( 'garbage' ) ); 83 83 84 84 // With convert_to_screen(), the same ID should return the exact $current_screen. 85 85 $this->assertSame( $current_screen, convert_to_screen( $screen->id ), $hook_name ); -
trunk/tests/adminbar.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/ajax/Response.php
r975 r1148 62 62 * Note: headers_list doesn't work properly in CLI mode, fall back on 63 63 * xdebug_get_headers if it's available 64 * Needs a separate process to get around the headers/output from the 64 * Needs a separate process to get around the headers/output from the 65 65 * bootstrapper 66 66 * @ticket 19448 … … 90 90 */ 91 91 public function test_response_charset_in_xml() { 92 92 93 93 // Generate an ajax response 94 94 ob_start(); -
trunk/tests/attachment/slashes.php
r1071 r1148 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); 14 14 15 15 // it is important to test with both even and odd numbered slashes as 16 16 // kses does a strip-then-add slashes in some of it's function calls -
trunk/tests/canonical/permalinkFormats.php
r1113 r1148 62 62 foreach ( $tests as $permalink_format => $expected ) { 63 63 update_option( 'permalink_structure', $permalink_format ); 64 64 65 65 // Get the rewrite rules 66 66 $rules = $wp_rewrite->generate_rewrite_rules( get_option( 'permalink_structure' ), EP_PERMALINK, false, false, false, false ); 67 67 68 68 // Filter out only the post rewrite rule 69 69 foreach ( $rules as $regex => $url ) { -
trunk/tests/comment.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/comment/slashes.php
r1041 r1148 13 13 $this->old_current_user = get_current_user_id(); 14 14 wp_set_current_user( $this->author_id ); 15 15 16 16 // it is important to test with both even and odd numbered slashes as 17 17 // kses does a strip-then-add slashes in some of it's function calls … … 37 37 $post_id = $this->factory->post->create(); 38 38 39 // not testing comment_author_email or comment_author_url 39 // not testing comment_author_email or comment_author_url 40 40 // as slashes are not permitted in that data 41 41 $data = array( … … 74 74 )); 75 75 76 // not testing comment_author_email or comment_author_url 76 // not testing comment_author_email or comment_author_url 77 77 // as slashes are not permitted in that data 78 78 $_POST = array(); … … 81 81 $_POST['content'] = $this->slash_7; 82 82 $_POST = add_magic_quotes( $_POST ); 83 83 84 84 edit_comment(); 85 85 $comment = get_comment( $comment_id ); … … 93 93 $_POST['content'] = $this->slash_4; 94 94 $_POST = add_magic_quotes( $_POST ); 95 95 96 96 edit_comment(); 97 97 $comment = get_comment( $comment_id ); … … 107 107 function test_wp_insert_comment() { 108 108 $post_id = $this->factory->post->create(); 109 109 110 110 $comment_id = wp_insert_comment(array( 111 111 'comment_post_ID' => $post_id, … … 138 138 'comment_post_ID' => $post_id 139 139 )); 140 140 141 141 wp_update_comment(array( 142 142 'comment_ID' => $comment_id, -
trunk/tests/functions/deprecated.php
r1061 r1148 28 28 */ 29 29 protected $_deprecated_files = array(); 30 30 31 31 /** 32 32 * Set up the test fixture … … 105 105 ); 106 106 } 107 107 108 108 /** 109 109 * Check if something was deprecated … … 133 133 return false; 134 134 } 135 135 136 136 /** 137 137 * Test that wp_save_image_file has a deprecated argument when passed a GD resource … … 150 150 // Check if the arg was deprecated 151 151 $check = $this->was_deprecated( 'argument', 'wp_save_image_file' ); 152 $this->assertNotEmpty( $check ); 152 $this->assertNotEmpty( $check ); 153 153 } 154 154 155 155 /** 156 156 * Test that wp_save_image_file doesn't have a deprecated argument when passed a WP_Image_Editor -
trunk/tests/image/base.php
r1124 r1148 16 16 add_filter( 'image_editor_class', array( $this, 'setEngine') ); 17 17 } 18 18 19 19 /** 20 20 * Undo the image editor override … … 30 30 public function setEngine() { 31 31 return $this->editor_engine; 32 } 32 } 33 33 } -
trunk/tests/image/functions.php
r1126 r1148 14 14 */ 15 15 protected function get_mime_type( $filename ) { 16 $mime_type = ''; 17 if ( extension_loaded( 'fileinfo' ) ) { 16 $mime_type = ''; 17 if ( extension_loaded( 'fileinfo' ) ) { 18 18 $finfo = new finfo(); 19 19 $mime_type = $finfo->file( $filename, FILEINFO_MIME ); 20 } elseif ( function_exists('mime_content_type') ) { 20 } elseif ( function_exists('mime_content_type') ) { 21 21 $mime_type = mime_content_type( $filename ); 22 22 } … … 26 26 return $mime_type; 27 27 } 28 28 29 29 function test_is_image_positive() { 30 30 // these are all image files recognized by php … … 93 93 $this->assertFalse( file_is_displayable_image( DIR_TESTDATA.'/images/'.$file ), "file_is_valid_image($file) should return false" ); 94 94 } 95 } 96 95 } 96 97 97 /** 98 98 * Test save image file and mime_types … … 108 108 'image/png' 109 109 ); 110 110 111 111 // Test each image editor engine 112 112 $classes = array('WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'); 113 113 foreach ( $classes as $class ) { 114 114 115 115 // If the image editor isn't available, skip it 116 116 if ( ! call_user_func( array( $class, 'test' ) ) ) { … … 122 122 // Call wp_save_image_file 123 123 $img = WP_Image_Editor::get_instance( DIR_TESTDATA . '/images/canola.jpg' ); 124 124 125 125 // Save a file as each mime type, assert it works 126 126 foreach ( $mime_types as $mime_type ) { 127 $file = wp_tempnam(); 127 $file = wp_tempnam(); 128 128 $ret = wp_save_image_file( $file, $img, $mime_type, 1 ); 129 129 $this->assertNotEmpty( $ret ); 130 130 $this->assertNotInstanceOf( 'WP_Error', $ret ); 131 131 $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); 132 132 133 133 // Clean up 134 134 @unlink( $file ); … … 140 140 } 141 141 } 142 142 143 143 /** 144 144 * Test that a passed mime type overrides the extension in the filename … … 163 163 $file = wp_tempnam( 'tmp.jpg' ); 164 164 $ret = $img->save( $file, $mime_type ); 165 165 166 166 // Make assertions 167 167 $this->assertNotEmpty( $ret ); 168 168 $this->assertNotInstanceOf( 'WP_Error', $ret ); 169 169 $this->assertEquals( $mime_type, $this->get_mime_type( $ret['path'] ) ); 170 170 171 171 // Clean up 172 172 @unlink( $file ); … … 202 202 $filter = create_function( '', "return '$class';" ); 203 203 add_filter( 'image_editor_class', $filter ); 204 204 205 205 // Save the image as each file extension, check the mime type 206 206 $img = WP_Image_Editor::get_instance( DIR_TESTDATA . '/images/canola.jpg' ); -
trunk/tests/image/resize.php
r1123 r1148 127 127 $this->assertEquals( 'error_loading_image', $image->get_error_code() ); 128 128 } 129 129 130 130 /** 131 131 * Try resizing a php file (bad image) -
trunk/tests/image/resize_gd.php
r1123 r1148 10 10 /** 11 11 * Use the GD image editor engine 12 * @var string 12 * @var string 13 13 */ 14 14 public $editor_engine = 'WP_Image_Editor_GD'; -
trunk/tests/image/resize_imagick.php
r1123 r1148 10 10 /** 11 11 * Use the Imagick image editor engine 12 * @var string 12 * @var string 13 13 */ 14 14 public $editor_engine = 'WP_Image_Editor_Imagick'; -
trunk/tests/includes/factory.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/iterators.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/l10n.php
-
Property
svn:eol-style
set to
native
-
Property
svn:eol-style
set to
-
trunk/tests/link.php
-
Property
svn:eol-style
set to
native
r1140 r1148 22 22 $_SERVER['REQUEST_URI'] = '/woohoo'; 23 23 $paged = get_pagenum_link( 2 ); 24 24 25 25 remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) ); 26 26 $this->assertEquals( $paged, home_url( '/WooHoo/page/2/' ) ); -
Property
svn:eol-style
set to
-
trunk/tests/option/slashes.php
r1071 r1148 35 35 $this->assertEquals( $this->slash_4, get_option( 'slash_test_4' ) ); 36 36 } 37 37 38 38 /** 39 39 * Tests the model function that expects un-slashed data … … 42 42 function test_update_option() { 43 43 add_option( 'slash_test_5', 'foo' ); 44 44 45 45 update_option( 'slash_test_5', $this->slash_1 ); 46 46 $this->assertEquals( $this->slash_1, get_option( 'slash_test_5' ) ); -
trunk/tests/post/formats.php
r1143 r1148 55 55 $format = get_post_format( $post_id ); 56 56 $this->assertEquals( 'aside', $format ); 57 57 58 58 $result = set_post_format( $post_id, 'standard' ); 59 59 $this->assertNotInstanceOf( 'WP_Error', $result ); -
trunk/tests/post/query.php
r1138 r1148 224 224 'operator' => 'IN' 225 225 ) 226 ) 226 ) 227 227 ) ); 228 228 … … 242 242 $post_id5 = $this->factory->post->create(); 243 243 add_post_meta( $post_id5, 'time', 1000 ); 244 244 245 245 $args = array( 246 246 'meta_key' => 'time', … … 258 258 $posts = wp_list_pluck( $query->posts, 'ID' ); 259 259 $this->assertEqualSets( array( $post_id2, $post_id3 ), $posts ); 260 260 261 261 $args = array( 262 262 'meta_key' => 'time', … … 429 429 'terms' => array( $cat_a ), 430 430 ) 431 ) 431 ) 432 432 ) ); 433 433 … … 442 442 'include_children' => false 443 443 ) 444 ) 444 ) 445 445 ) ); 446 446 … … 454 454 'terms' => array( $cat_b ), 455 455 ) 456 ) 456 ) 457 457 ) ); 458 458 … … 467 467 'include_children' => false 468 468 ) 469 ) 469 ) 470 470 ) ); 471 471 … … 479 479 'terms' => array( $cat_c ), 480 480 ) 481 ) 481 ) 482 482 ) ); 483 483 … … 492 492 'include_children' => false 493 493 ) 494 ) 494 ) 495 495 ) ); 496 496 -
trunk/tests/post/slashes.php
r1041 r1148 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); 14 14 15 15 // it is important to test with both even and odd numbered slashes as 16 16 // kses does a strip-then-add slashes in some of it's function calls … … 103 103 function test_wp_update_post() { 104 104 $id = $this->factory->post->create(); 105 105 106 106 wp_update_post(array( 107 107 'ID' => $id, -
trunk/tests/term/slashes.php
r1071 r1148 39 39 ); 40 40 $_POST = add_magic_quotes( $_POST ); 41 41 42 42 // Make the request 43 43 try { … … 46 46 unset( $e ); 47 47 } 48 48 49 49 $term = get_term_by( 'slug', 'string-with-1-slash', 'category' ); 50 50 $this->assertEquals( $this->slash_1, $term->name ); … … 57 57 ); 58 58 $_POST = add_magic_quotes( $_POST ); 59 59 60 60 // Make the request 61 61 try { … … 64 64 unset( $e ); 65 65 } 66 66 67 67 $term = get_term_by( 'slug', 'string-with-3-slashes', 'category' ); 68 68 $this->assertEquals( $this->slash_3, $term->name ); … … 75 75 ); 76 76 $_POST = add_magic_quotes( $_POST ); 77 77 78 78 // Make the request 79 79 try { … … 82 82 unset( $e ); 83 83 } 84 84 85 85 $term = get_term_by( 'slug', 'string-with-2-slashes', 'category' ); 86 86 $this->assertEquals( $this->slash_2, $term->name ); 87 87 88 88 } 89 89 90 90 /** 91 91 * Tests the controller function that expects slashed data … … 99 99 foreach ( $taxonomies as $taxonomy ) { 100 100 $_POST = $_GET = $_REQUEST = array(); 101 101 102 102 $_POST = array( 103 103 '_wpnonce_add-tag' => wp_create_nonce( 'add-tag' ), … … 108 108 ); 109 109 $_POST = add_magic_quotes( $_POST ); 110 110 111 111 // Make the request 112 112 try { … … 115 115 unset( $e ); 116 116 } 117 117 118 118 $term = get_term_by( 'slug', 'controller_slash_test_1_'.$taxonomy, $taxonomy ); 119 119 $this->assertEquals( $this->slash_1, $term->name ); … … 128 128 ); 129 129 $_POST = add_magic_quotes( $_POST ); 130 130 131 131 // Make the request 132 132 try { … … 135 135 unset( $e ); 136 136 } 137 137 138 138 $term = get_term_by( 'slug', 'controller_slash_test_2_'.$taxonomy, $taxonomy ); 139 139 $this->assertEquals( $this->slash_3, $term->name ); … … 148 148 ); 149 149 $_POST = add_magic_quotes( $_POST ); 150 150 151 151 // Make the request 152 152 try { … … 155 155 unset( $e ); 156 156 } 157 157 158 158 $term = get_term_by( 'slug', 'controller_slash_test_3_'.$taxonomy, $taxonomy ); 159 159 $this->assertEquals( $this->slash_2, $term->name ); … … 161 161 } 162 162 } 163 163 164 164 /** 165 165 * Tests the model function that expects un-slashed data … … 183 183 $this->assertEquals( $this->slash_1, $term->name ); 184 184 $this->assertEquals( $this->slash_3, $term->description ); 185 185 186 186 $insert = wp_insert_term( 187 187 $this->slash_3, … … 195 195 $this->assertEquals( $this->slash_3, $term->name ); 196 196 $this->assertEquals( $this->slash_5, $term->description ); 197 197 198 198 $insert = wp_insert_term( 199 199 $this->slash_2, … … 223 223 'taxonomy' => $taxonomy 224 224 )); 225 225 226 226 $update = wp_update_term( 227 227 $id, … … 236 236 $this->assertEquals( $this->slash_1, $term->name ); 237 237 $this->assertEquals( $this->slash_3, $term->description ); 238 238 239 239 $update = wp_update_term( 240 240 $id, … … 248 248 $this->assertEquals( $this->slash_3, $term->name ); 249 249 $this->assertEquals( $this->slash_5, $term->description ); 250 250 251 251 $update = wp_update_term( 252 252 $id, -
trunk/tests/user/slashes.php
r1071 r1148 12 12 $this->old_current_user = get_current_user_id(); 13 13 wp_set_current_user( $this->author_id ); 14 14 15 15 // it is important to test with both even and odd numbered slashes as 16 16 // kses does a strip-then-add slashes in some of it's function calls
Note: See TracChangeset
for help on using the changeset viewer.