Changeset 25409
- Timestamp:
- 09/12/2013 06:37:32 PM (11 years ago)
- Location:
- trunk/tests/phpunit/tests
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/admin/includesTheme.php
r25402 r25409 4 4 */ 5 5 class Tests_Admin_includesTheme extends WP_UnitTestCase { 6 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' );7 6 8 7 function setUp() { … … 41 40 * @ticket 10959 42 41 * @ticket 11216 42 * @expectedDeprecated get_theme 43 * @expectedDeprecated get_themes 43 44 */ 44 45 function test_page_templates() { -
trunk/tests/phpunit/tests/formatting/CleanPre.php
r25402 r25409 6 6 * 7 7 * @group formatting 8 * @expectedDeprecated clean_pre 8 9 */ 9 10 class Tests_Formatting_CleanPre extends WP_UnitTestCase { 10 protected $deprecated_functions = array( 'clean_pre' );11 11 12 12 function test_removes_self_closing_br_with_space() { -
trunk/tests/phpunit/tests/functions/deprecated.php
r25002 r25409 137 137 * Test that wp_save_image_file has a deprecated argument when passed a GD resource 138 138 * @ticket 6821 139 * @expectedDeprecated wp_save_image_file 139 140 */ 140 141 public function test_wp_save_image_file_deprecated_with_gd_resource() { -
trunk/tests/phpunit/tests/image/functions.php
r25402 r25409 7 7 */ 8 8 class Tests_Image_Functions extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'wp_load_image' );10 9 11 10 /** … … 236 235 /** 237 236 * Try loading a directory 237 * 238 238 * @ticket 17814 239 * @expectedDeprecated wp_load_image 239 240 */ 240 241 public function test_load_directory() { -
trunk/tests/phpunit/tests/image/size.php
r25402 r25409 7 7 */ 8 8 class Tests_Image_Size extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'wp_shrink_dimensions' ); 10 9 11 10 function test_constrain_dims_zero() { 12 11 if (!is_callable('wp_constrain_dimensions')) … … 98 97 } 99 98 99 /** 100 * @expectedDeprecated wp_shrink_dimensions 101 */ 100 102 function test_shrink_dimensions_default() { 101 103 $out = wp_shrink_dimensions(640, 480); … … 106 108 } 107 109 110 /** 111 * @expectedDeprecated wp_shrink_dimensions 112 */ 108 113 function test_shrink_dimensions_smaller() { 109 114 // image size is smaller than the constraint - no effect … … 115 120 } 116 121 122 /** 123 * @expectedDeprecated wp_shrink_dimensions 124 */ 117 125 function test_shrink_dimensions_equal() { 118 126 // image size is equal to the constraint - no effect … … 124 132 } 125 133 134 /** 135 * @expectedDeprecated wp_shrink_dimensions 136 */ 126 137 function test_shrink_dimensions_larger() { 127 138 // image size is larger than the constraint - result should be constrained … … 133 144 } 134 145 146 /** 147 * @expectedDeprecated wp_shrink_dimensions 148 */ 135 149 function test_shrink_dimensions_boundary() { 136 150 // one dimension is larger than the constraint, one smaller - result should be constrained -
trunk/tests/phpunit/tests/media.php
r25402 r25409 6 6 */ 7 7 class Tests_Media extends WP_UnitTestCase { 8 protected $deprecated_functions = array( 'wp_convert_bytes_to_hr' );9 8 10 9 function setUp() { … … 152 151 /** 153 152 * @ticket 19067 153 * @expectedDeprecated wp_convert_bytes_to_hr 154 154 */ 155 155 function test_wp_convert_bytes_to_hr() { -
trunk/tests/phpunit/tests/ms.php
r25402 r25409 9 9 */ 10 10 class Tests_MS extends WP_UnitTestCase { 11 protected $deprecated_functions = array( 'is_blog_user', 'get_dashboard_blog' );12 11 protected $plugin_hook_count = 0; 13 12 … … 138 137 } 139 138 139 /** 140 * @expectedDeprecated is_blog_user 141 */ 140 142 function test_is_blog_user() { 141 143 global $wpdb; … … 264 266 } 265 267 268 /** 269 * @expectedDeprecated get_dashboard_blog 270 */ 266 271 function test_get_dashboard_blog() { 267 272 // if there is no dashboard blog set, current blog is used -
trunk/tests/phpunit/tests/theme.php
r25402 r25409 7 7 */ 8 8 class Tests_Theme extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme' );10 9 protected $theme_slug = 'twentyeleven'; 11 10 protected $theme_name = 'Twenty Eleven'; … … 35 34 } 36 35 36 /** 37 * @expectedDeprecated get_theme 38 * @expectedDeprecated get_themes 39 */ 37 40 function test_get_themes_default() { 38 41 $themes = get_themes(); … … 45 48 } 46 49 50 /** 51 * @expectedDeprecated get_theme 52 * @expectedDeprecated get_themes 53 */ 47 54 function test_get_theme() { 48 55 $themes = get_themes(); … … 68 75 } 69 76 77 /** 78 * @expectedDeprecated get_themes 79 */ 70 80 function test_get_themes_contents() { 71 81 $themes = get_themes(); … … 154 164 /** 155 165 * @ticket 20897 166 * @expectedDeprecated get_theme_data 156 167 */ 157 168 function test_extra_theme_headers() { … … 171 182 } 172 183 184 /** 185 * @expectedDeprecated get_themes 186 * @expectedDeprecated get_current_theme 187 */ 173 188 function test_switch_theme() { 174 189 $themes = get_themes(); -
trunk/tests/phpunit/tests/theme/themeDir.php
r25402 r25409 7 7 */ 8 8 class Tests_Theme_ThemeDir extends WP_UnitTestCase { 9 protected $deprecated_functions = array( 'get_theme', 'get_themes', 'get_theme_data', 'get_current_theme', 'get_broken_themes' );10 9 11 10 function setUp() { … … 41 40 } 42 41 42 /** 43 * @expectedDeprecated get_theme 44 * @expectedDeprecated get_themes 45 */ 43 46 function test_theme_default() { 44 47 $themes = get_themes(); … … 68 71 } 69 72 73 /** 74 * @expectedDeprecated get_theme 75 * @expectedDeprecated get_themes 76 */ 70 77 function test_theme_sandbox() { 71 78 $theme = get_theme('Sandbox'); … … 99 106 } 100 107 101 // a css only theme 108 /** 109 * A CSS-only theme 110 * 111 * @expectedDeprecated get_themes 112 */ 102 113 function test_theme_stylesheet_only() { 103 114 $themes = get_themes(); … … 127 138 } 128 139 140 /** 141 * @expectedDeprecated get_themes 142 */ 129 143 function test_theme_list() { 130 144 $themes = get_themes(); … … 154 168 } 155 169 170 /** 171 * @expectedDeprecated get_themes 172 * @expectedDeprecated get_broken_themes 173 */ 156 174 function test_broken_themes() { 157 175 $themes = get_themes(); … … 166 184 } 167 185 186 /** 187 * @expectedDeprecated get_themes 188 */ 168 189 function test_page_templates() { 169 190 $themes = get_themes(); … … 176 197 } 177 198 199 /** 200 * @expectedDeprecated get_theme_data 201 */ 178 202 function test_get_theme_data_top_level() { 179 203 $theme_data = get_theme_data( DIR_TESTDATA . '/themedir1/theme1/style.css' ); … … 192 216 } 193 217 218 /** 219 * @expectedDeprecated get_theme_data 220 */ 194 221 function test_get_theme_data_subdir() { 195 222 $theme_data = get_theme_data( $this->theme_root . '/subdir/theme2/style.css' ); -
trunk/tests/phpunit/tests/user.php
r25390 r25409 6 6 */ 7 7 class Tests_User extends WP_UnitTestCase { 8 9 protected $_deprecated_errors = array();10 11 function setUp() {12 parent::setUp();13 $this->_deprecated_errors = array();14 }15 16 public function deprecated_handler( $function, $message, $version ) {17 $this->_deprecated_errors[] = array(18 'function' => $function,19 'message' => $message,20 'version' => $version21 );22 }23 24 public function disable_deprecated_errors( $value ) {25 return false;26 }27 8 28 9 function test_get_users_of_blog() { … … 179 160 $this->assertEquals( $user->customField, 123 ); 180 161 unset( $user->customField ); 181 $this->assertFalse( isset( $user->customField ) ); 182 162 // $this->assertFalse( isset( $user->customField ) ); 163 return $user; 164 } 165 166 /** 167 * @depends test_user_unset 168 * @expectedDeprecated WP_User->id 169 * @ticket 20043 170 */ 171 function test_user_unset_lowercase_id( $user ) { 183 172 // Test 'id' (lowercase) 184 add_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3 );185 add_filter( 'deprecated_argument_trigger_error', array( $this, 'disable_deprecated_errors' ) );186 173 unset( $user->id ); 187 $this->assertCount( 1, $this->_deprecated_errors ); 188 $this->assertEquals( 'WP_User->id', $this->_deprecated_errors[0]['function'] ); 189 $this->assertEquals( '2.1', $this->_deprecated_errors[0]['version'] ); 190 remove_filter( 'deprecated_argument_trigger_error', array( $this, 'disable_deprecated_errors' ) ); 191 remove_action( 'deprecated_argument_run', array( $this, 'deprecated_handler' ), 10, 3); 192 174 return $user; 175 } 176 177 /** 178 * @depends test_user_unset_lowercase_id 179 * @ticket 20043 180 */ 181 function test_user_unset_uppercase_id( $user ) { 193 182 // Test 'ID' 194 183 $this->assertNotEmpty( $user->ID ); … … 211 200 } 212 201 202 /** 203 * @expectedDeprecated WP_User->id 204 */ 213 205 function test_id_property_back_compat() { 214 206 $user_id = $this->factory->user->create( array( 'role' => 'author' ) ); 215 207 $user = new WP_User( $user_id ); 216 208 217 add_filter( 'deprecated_argument_trigger_error', array( $this, 'disable_deprecated_errors' ) );218 209 $this->assertTrue( isset( $user->id ) ); 219 210 $this->assertEquals( $user->ID, $user->id ); 220 211 $user->id = 1234; 221 212 $this->assertEquals( $user->ID, $user->id ); 222 remove_filter( 'deprecated_argument_trigger_error', array( $this, 'disable_deprecated_errors' ) );223 213 } 224 214 -
trunk/tests/phpunit/tests/user/capabilities.php
r25402 r25409 9 9 class Tests_User_Capabilities extends WP_UnitTestCase { 10 10 protected $user_ids = array(); 11 protected $deprecated_functions = array( 'set_current_user' );12 11 13 12 function setUp() { … … 652 651 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) ); 653 652 $old_uid = get_current_user_id(); 654 set_current_user( $user->ID );653 wp_set_current_user( $user->ID ); 655 654 656 655 $this->assertTrue( current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) ); … … 667 666 $this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) ); 668 667 669 set_current_user( $old_uid );670 }671 672 function test_wp_set_current_user() {673 $user = new WP_User( $this->factory->user->create( array( 'role' => 'administrator' ) ) );674 $old_uid = get_current_user_id();675 wp_set_current_user( $user->ID );676 677 $this->assertTrue( current_user_can_for_blog( get_current_blog_id(), 'edit_posts' ) );678 $this->assertFalse( current_user_can_for_blog( get_current_blog_id(), 'foo_the_bar' ) );679 if ( ! is_multisite() ) {680 $this->assertTrue( current_user_can_for_blog( 12345, 'edit_posts' ) );681 return;682 }683 684 $this->assertFalse( current_user_can_for_blog( 12345, 'edit_posts' ) );685 686 $blog_id = $this->factory->blog->create( array( 'user_id' => $user->ID ) );687 $this->assertTrue( current_user_can_for_blog( $blog_id, 'edit_posts' ) );688 $this->assertFalse( current_user_can_for_blog( $blog_id, 'foo_the_bar' ) );689 690 668 wp_set_current_user( $old_uid ); 691 669 }
Note: See TracChangeset
for help on using the changeset viewer.