Changeset 44573
- Timestamp:
- 01/12/2019 06:05:55 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/phpcs.xml.dist
r44571 r44573 9 9 <properties> 10 10 <property name="allowMultipleArguments" value="false"/> 11 </properties> 12 </rule> 13 14 <rule ref="WordPress.NamingConventions.ValidVariableName"> 15 <properties> 16 <property name="customPropertiesWhitelist" type="array"> 17 <!-- From database structure queries --> 18 <element value="Collation"/> 19 <element value="Column_name"/> 20 <element value="Default"/> 21 <element value="Extra"/> 22 <element value="Field"/> 23 <element value="Index_type"/> 24 <element value="Key"/> 25 <element value="Key_name"/> 26 <element value="Msg_text"/> 27 <element value="Non_unique"/> 28 <element value="Null"/> 29 <element value="Sub_part"/> 30 <element value="Type"/> 31 <!-- From plugin/theme data --> 32 <element value="authorAndUri"/> 33 <element value="Name"/> 34 <element value="Version"/> 35 <!-- From the result of wp_xmlrpc_server::wp_getPageList() --> 36 <element value="dateCreated"/> 37 38 <!-- From DOMDocument --> 39 <element value="childNodes"/> 40 <element value="formatOutput"/> 41 <element value="nodeName"/> 42 <element value="nodeType"/> 43 <element value="parentNode"/> 44 <element value="preserveWhiteSpace"/> 45 <element value="textContent"/> 46 <!-- From PHPMailer --> 47 <element value="AltBody"/> 48 <element value="Body"/> 49 <element value="CharSet"/> 50 <element value="ContentType"/> 51 <element value="Encoding"/> 52 <element value="Hostname"/> 53 <element value="mailHeader"/> 54 <element value="MIMEBody"/> 55 <element value="MIMEHeader"/> 56 <element value="Sender"/> 57 <element value="Subject"/> 58 <!-- From PHPUnit_Util_Getopt --> 59 <element value="longOptions"/> 60 <!-- From POP3 --> 61 <element value="ERROR"/> 62 <!-- From ZipArchive --> 63 <element value="numFiles"/> 64 </property> 11 65 </properties> 12 66 </rule> -
trunk/src/wp-includes/class-wp-comment-query.php
r44546 r44573 556 556 557 557 $orderby_array = array(); 558 $found_orderby_comment_ ID= false;558 $found_orderby_comment_id = false; 559 559 foreach ( $ordersby as $_key => $_value ) { 560 560 if ( ! $_value ) { … … 570 570 } 571 571 572 if ( ! $found_orderby_comment_ ID&& in_array( $_orderby, array( 'comment_ID', 'comment__in' ) ) ) {573 $found_orderby_comment_ ID= true;572 if ( ! $found_orderby_comment_id && in_array( $_orderby, array( 'comment_ID', 'comment__in' ) ) ) { 573 $found_orderby_comment_id = true; 574 574 } 575 575 … … 594 594 595 595 // To ensure determinate sorting, always include a comment_ID clause. 596 if ( ! $found_orderby_comment_ ID) {597 $comment_ ID_order = '';596 if ( ! $found_orderby_comment_id ) { 597 $comment_id_order = ''; 598 598 599 599 // Inherit order from comment_date or comment_date_gmt, if available. 600 600 foreach ( $orderby_array as $orderby_clause ) { 601 601 if ( preg_match( '/comment_date(?:_gmt)*\ (ASC|DESC)/', $orderby_clause, $match ) ) { 602 $comment_ ID_order = $match[1];602 $comment_id_order = $match[1]; 603 603 break; 604 604 } … … 606 606 607 607 // If no date-related order is available, use the date from the first available clause. 608 if ( ! $comment_ ID_order ) {608 if ( ! $comment_id_order ) { 609 609 foreach ( $orderby_array as $orderby_clause ) { 610 610 if ( false !== strpos( 'ASC', $orderby_clause ) ) { 611 $comment_ ID_order = 'ASC';611 $comment_id_order = 'ASC'; 612 612 } else { 613 $comment_ ID_order = 'DESC';613 $comment_id_order = 'DESC'; 614 614 } 615 615 … … 619 619 620 620 // Default to DESC. 621 if ( ! $comment_ ID_order ) {622 $comment_ ID_order = 'DESC';623 } 624 625 $orderby_array[] = "$wpdb->comments.comment_ID $comment_ ID_order";621 if ( ! $comment_id_order ) { 622 $comment_id_order = 'DESC'; 623 } 624 625 $orderby_array[] = "$wpdb->comments.comment_ID $comment_id_order"; 626 626 } 627 627 -
trunk/tests/phpunit/tests/avatar.php
r44499 r44573 104 104 } 105 105 106 protected $fake URL;106 protected $fake_url; 107 107 /** 108 108 * @ticket 21195 109 109 */ 110 110 public function test_pre_get_avatar_url_filter() { 111 $this->fake URL= 'haha wat';111 $this->fake_url = 'haha wat'; 112 112 113 113 add_filter( 'pre_get_avatar_data', array( $this, 'pre_get_avatar_url_filter' ), 10, 1 ); … … 115 115 remove_filter( 'pre_get_avatar_data', array( $this, 'pre_get_avatar_url_filter' ), 10 ); 116 116 117 $this->assertEquals( $url, $this->fake URL);117 $this->assertEquals( $url, $this->fake_url ); 118 118 } 119 119 public function pre_get_avatar_url_filter( $args ) { 120 $args['url'] = $this->fake URL;120 $args['url'] = $this->fake_url; 121 121 return $args; 122 122 } … … 126 126 */ 127 127 public function test_get_avatar_url_filter() { 128 $this->fake URL= 'omg lol';128 $this->fake_url = 'omg lol'; 129 129 130 130 add_filter( 'get_avatar_url', array( $this, 'get_avatar_url_filter' ), 10, 1 ); … … 132 132 remove_filter( 'get_avatar_url', array( $this, 'get_avatar_url_filter' ), 10 ); 133 133 134 $this->assertEquals( $url, $this->fake URL);134 $this->assertEquals( $url, $this->fake_url ); 135 135 } 136 136 public function get_avatar_url_filter( $url ) { 137 return $this->fake URL;137 return $this->fake_url; 138 138 } 139 139 … … 208 208 209 209 210 protected $fake IMG;210 protected $fake_img; 211 211 /** 212 212 * @ticket 21195 213 213 */ 214 214 public function test_pre_get_avatar_filter() { 215 $this->fake IMG= 'YOU TOO?!';215 $this->fake_img = 'YOU TOO?!'; 216 216 217 217 add_filter( 'pre_get_avatar', array( $this, 'pre_get_avatar_filter' ), 10, 1 ); … … 219 219 remove_filter( 'pre_get_avatar', array( $this, 'pre_get_avatar_filter' ), 10 ); 220 220 221 $this->assertEquals( $img, $this->fake IMG);221 $this->assertEquals( $img, $this->fake_img ); 222 222 } 223 223 public function pre_get_avatar_filter( $img ) { 224 return $this->fake IMG;224 return $this->fake_img; 225 225 } 226 226 … … 229 229 */ 230 230 public function test_get_avatar_filter() { 231 $this->fake URL= 'YA RLY';231 $this->fake_url = 'YA RLY'; 232 232 233 233 add_filter( 'get_avatar', array( $this, 'get_avatar_filter' ), 10, 1 ); … … 235 235 remove_filter( 'get_avatar', array( $this, 'get_avatar_filter' ), 10 ); 236 236 237 $this->assertEquals( $img, $this->fake URL);237 $this->assertEquals( $img, $this->fake_url ); 238 238 } 239 239 public function get_avatar_filter( $img ) { 240 return $this->fake URL;240 return $this->fake_url; 241 241 } 242 242 -
trunk/tests/phpunit/tests/functions.php
r44546 r44573 8 8 $x = new MockClass; 9 9 $x->_baba = 5; 10 $x->yZ = 'baba'; 10 $x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar 11 11 $x->a = array( 5, 111, 'x' ); 12 12 $this->assertEquals( … … 44 44 $x = new MockClass; 45 45 $x->_baba = 5; 46 $x->yZ = 'baba'; 46 $x->yZ = 'baba'; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar 47 47 $x->a = array( 5, 111, 'x' ); 48 48 $d = array( 'pu' => 'bu' ); -
trunk/tests/phpunit/tests/general/wpError.php
r42761 r44573 15 15 * @var WP_Error 16 16 */ 17 public $ WP_Error;17 public $wp_error; 18 18 19 19 /** … … 23 23 parent::setUp(); 24 24 25 $this-> WP_Error = new WP_Error();25 $this->wp_error = new WP_Error(); 26 26 } 27 27 28 28 public function test_WP_Error_should_be_of_type_WP_Error() { 29 $this->assertWPError( $this-> WP_Error );29 $this->assertWPError( $this->wp_error ); 30 30 } 31 31 32 32 public function test_WP_Error_with_default_empty_parameters_should_add_no_errors() { 33 $this->assertEmpty( $this-> WP_Error->errors );33 $this->assertEmpty( $this->wp_error->errors ); 34 34 } 35 35 36 36 public function test_WP_Error_with_empty_code_should_add_no_code() { 37 $this->assertSame( '', $this-> WP_Error->get_error_code() );37 $this->assertSame( '', $this->wp_error->get_error_code() ); 38 38 } 39 39 40 40 public function test_WP_Error_with_empty_code_should_add_no_message() { 41 $this->assertSame( '', $this-> WP_Error->get_error_message() );41 $this->assertSame( '', $this->wp_error->get_error_message() ); 42 42 } 43 43 44 44 public function test_WP_Error_with_empty_code_should_add_no_error_data() { 45 $this->assertEmpty( $this-> WP_Error->error_data );45 $this->assertEmpty( $this->wp_error->error_data ); 46 46 } 47 47 … … 104 104 */ 105 105 public function test_get_error_codes_with_no_errors_should_return_empty_array() { 106 $this->assertEmpty( $this-> WP_Error->get_error_codes() );106 $this->assertEmpty( $this->wp_error->get_error_codes() ); 107 107 } 108 108 … … 111 111 */ 112 112 public function test_get_error_codes_with_one_error_should_return_an_array_with_only_that_code() { 113 $this-> WP_Error->add( 'code', 'message' );114 115 $this->assertEqualSets( array( 'code' ), $this-> WP_Error->get_error_codes() );113 $this->wp_error->add( 'code', 'message' ); 114 115 $this->assertEqualSets( array( 'code' ), $this->wp_error->get_error_codes() ); 116 116 } 117 117 … … 120 120 */ 121 121 public function test_get_error_codes_with_multiple_errors_should_return_an_array_of_those_codes() { 122 $this-> WP_Error->add( 'code', 'message' );123 $this-> WP_Error->add( 'code2', 'message2' );122 $this->wp_error->add( 'code', 'message' ); 123 $this->wp_error->add( 'code2', 'message2' ); 124 124 125 125 $expected = array( 'code', 'code2' ); 126 126 127 $this->assertEqualSets( $expected, $this-> WP_Error->get_error_codes() );127 $this->assertEqualSets( $expected, $this->wp_error->get_error_codes() ); 128 128 } 129 129 … … 132 132 */ 133 133 public function test_get_error_code_with_no_errors_should_return_an_empty_string() { 134 $this->assertSame( '', $this-> WP_Error->get_error_code() );134 $this->assertSame( '', $this->wp_error->get_error_code() ); 135 135 } 136 136 … … 139 139 */ 140 140 public function test_get_error_code_with_one_error_should_return_that_error_code() { 141 $this-> WP_Error->add( 'code', 'message' );142 143 $this->assertSame( 'code', $this-> WP_Error->get_error_code() );141 $this->wp_error->add( 'code', 'message' ); 142 143 $this->assertSame( 'code', $this->wp_error->get_error_code() ); 144 144 } 145 145 … … 148 148 */ 149 149 public function test_get_error_code_with_multiple_errors_should_return_only_the_first_error_code() { 150 $this-> WP_Error->add( 'code', 'message' );151 $this-> WP_Error->add( 'code2', 'message2' );152 153 $this->assertSame( 'code', $this-> WP_Error->get_error_code() );150 $this->wp_error->add( 'code', 'message' ); 151 $this->wp_error->add( 'code2', 'message2' ); 152 153 $this->assertSame( 'code', $this->wp_error->get_error_code() ); 154 154 } 155 155 … … 158 158 */ 159 159 public function test_get_error_messages_with_empty_code_and_no_errors_should_return_an_empty_array() { 160 $this->assertEmpty( $this-> WP_Error->get_error_messages() );160 $this->assertEmpty( $this->wp_error->get_error_messages() ); 161 161 } 162 162 … … 165 165 */ 166 166 public function test_get_error_messages_with_empty_code_one_error_should_return_an_array_with_that_message() { 167 $this-> WP_Error->add( 'code', 'message' );168 169 $this->assertEqualSets( array( 'message' ), $this-> WP_Error->get_error_messages() );167 $this->wp_error->add( 'code', 'message' ); 168 169 $this->assertEqualSets( array( 'message' ), $this->wp_error->get_error_messages() ); 170 170 } 171 171 … … 174 174 */ 175 175 public function test_get_error_messages_with_empty_code_multiple_errors_should_return_an_array_of_messages() { 176 $this-> WP_Error->add( 'code', 'message' );177 $this-> WP_Error->add( 'code2', 'message2' );178 179 $this->assertEqualSets( array( 'message', 'message2' ), $this-> WP_Error->get_error_messages() );176 $this->wp_error->add( 'code', 'message' ); 177 $this->wp_error->add( 'code2', 'message2' ); 178 179 $this->assertEqualSets( array( 'message', 'message2' ), $this->wp_error->get_error_messages() ); 180 180 } 181 181 … … 184 184 */ 185 185 public function test_get_error_messages_with_an_invalid_code_should_return_an_empty_array() { 186 $this->assertEmpty( $this-> WP_Error->get_error_messages( 'code' ) );186 $this->assertEmpty( $this->wp_error->get_error_messages( 'code' ) ); 187 187 } 188 188 … … 191 191 */ 192 192 public function test_get_error_messages_with_one_error_should_return_an_array_with_that_message() { 193 $this-> WP_Error->add( 'code', 'message' );194 195 $this->assertEqualSets( array( 'message' ), $this-> WP_Error->get_error_messages( 'code' ) );193 $this->wp_error->add( 'code', 'message' ); 194 195 $this->assertEqualSets( array( 'message' ), $this->wp_error->get_error_messages( 'code' ) ); 196 196 } 197 197 … … 200 200 */ 201 201 public function test_get_error_messages_with_multiple_errors_same_code_should_return_an_array_with_all_messages() { 202 $this-> WP_Error->add( 'code', 'message' );203 $this-> WP_Error->add( 'code', 'message2' );204 205 $this->assertequalSets( array( 'message', 'message2' ), $this-> WP_Error->get_error_messages( 'code' ) );202 $this->wp_error->add( 'code', 'message' ); 203 $this->wp_error->add( 'code', 'message2' ); 204 205 $this->assertequalSets( array( 'message', 'message2' ), $this->wp_error->get_error_messages( 'code' ) ); 206 206 } 207 207 … … 210 210 */ 211 211 public function test_get_error_message_with_empty_code_and_no_errors_should_return_an_empty_string() { 212 $this->assertSame( '', $this-> WP_Error->get_error_message() );212 $this->assertSame( '', $this->wp_error->get_error_message() ); 213 213 } 214 214 … … 217 217 */ 218 218 public function test_get_error_message_with_empty_code_and_one_error_should_return_that_message() { 219 $this-> WP_Error->add( 'code', 'message' );220 221 $this->assertSame( 'message', $this-> WP_Error->get_error_message() );219 $this->wp_error->add( 'code', 'message' ); 220 221 $this->assertSame( 'message', $this->wp_error->get_error_message() ); 222 222 } 223 223 … … 226 226 */ 227 227 public function test_get_error_message_with_empty_code_and_multiple_errors_should_return_the_first_message() { 228 $this-> WP_Error->add( 'code', 'message' );229 $this-> WP_Error->add( 'code2', 'message2' );230 231 $this->assertSame( 'message', $this-> WP_Error->get_error_message() );228 $this->wp_error->add( 'code', 'message' ); 229 $this->wp_error->add( 'code2', 'message2' ); 230 231 $this->assertSame( 'message', $this->wp_error->get_error_message() ); 232 232 } 233 233 … … 236 236 */ 237 237 public function test_get_error_message_with_empty_code_and_multiple_errors_multiple_codes_should_return_the_first_message() { 238 $this-> WP_Error->add( 'code', 'message' );239 $this-> WP_Error->add( 'code2', 'message2' );240 $this-> WP_Error->add( 'code', 'message2' );241 242 $this->assertSame( 'message', $this-> WP_Error->get_error_message() );238 $this->wp_error->add( 'code', 'message' ); 239 $this->wp_error->add( 'code2', 'message2' ); 240 $this->wp_error->add( 'code', 'message2' ); 241 242 $this->assertSame( 'message', $this->wp_error->get_error_message() ); 243 243 } 244 244 … … 247 247 */ 248 248 public function test_get_error_message_with_invalid_code_and_no_errors_should_return_empty_string() { 249 $this->assertSame( '', $this-> WP_Error->get_error_message( 'invalid' ) );249 $this->assertSame( '', $this->wp_error->get_error_message( 'invalid' ) ); 250 250 } 251 251 … … 254 254 */ 255 255 public function test_get_error_message_with_invalid_code_and_one_error_should_return_an_empty_string() { 256 $this-> WP_Error->add( 'code', 'message' );257 258 $this->assertSame( '', $this-> WP_Error->get_error_message( 'invalid' ) );256 $this->wp_error->add( 'code', 'message' ); 257 258 $this->assertSame( '', $this->wp_error->get_error_message( 'invalid' ) ); 259 259 } 260 260 … … 263 263 */ 264 264 public function test_get_error_message_with_invalid_code_and_multiple_errors_should_return_an_empty_string() { 265 $this-> WP_Error->add( 'code', 'message' );266 $this-> WP_Error->add( 'code2', 'message2' );267 268 $this->assertSame( '', $this-> WP_Error->get_error_message( 'invalid' ) );265 $this->wp_error->add( 'code', 'message' ); 266 $this->wp_error->add( 'code2', 'message2' ); 267 268 $this->assertSame( '', $this->wp_error->get_error_message( 'invalid' ) ); 269 269 } 270 270 … … 273 273 */ 274 274 public function test_get_error_data_with_empty_code_and_no_errors_should_evaluate_as_null() { 275 $this->assertSame( null, $this-> WP_Error->get_error_data() );275 $this->assertSame( null, $this->wp_error->get_error_data() ); 276 276 } 277 277 … … 280 280 */ 281 281 public function test_get_error_data_with_empty_code_one_error_no_data_should_evaluate_as_null() { 282 $this-> WP_Error->add( 'code', 'message' );283 284 $this->assertSame( null, $this-> WP_Error->get_error_data() );282 $this->wp_error->add( 'code', 'message' ); 283 284 $this->assertSame( null, $this->wp_error->get_error_data() ); 285 285 } 286 286 … … 289 289 */ 290 290 public function test_get_error_data_with_empty_code_multiple_errors_no_data_should_evaluate_as_null() { 291 $this-> WP_Error->add( 'code', 'message' );292 $this-> WP_Error->add( 'code2', 'message2' );293 294 $this->assertSame( null, $this-> WP_Error->get_error_data() );291 $this->wp_error->add( 'code', 'message' ); 292 $this->wp_error->add( 'code2', 'message2' ); 293 294 $this->assertSame( null, $this->wp_error->get_error_data() ); 295 295 } 296 296 … … 300 300 public function test_get_error_data_with_empty_code_and_one_error_with_data_should_return_that_data() { 301 301 $expected = array( 'data-key' => 'data-value' ); 302 $this-> WP_Error->add( 'code', 'message', $expected );303 304 $this->assertEqualSetsWithIndex( $expected, $this-> WP_Error->get_error_data() );302 $this->wp_error->add( 'code', 'message', $expected ); 303 304 $this->assertEqualSetsWithIndex( $expected, $this->wp_error->get_error_data() ); 305 305 } 306 306 … … 310 310 public function test_get_error_data_with_empty_code_and_multiple_errors_different_codes_should_return_the_last_data_of_the_first_code() { 311 311 $expected = array( 'data-key' => 'data-value' ); 312 $this-> WP_Error->add( 'code', 'message', $expected );313 $this-> WP_Error->add( 'code2', 'message2', 'data2' );314 315 $this->assertEqualSetsWithIndex( $expected, $this-> WP_Error->get_error_data() );312 $this->wp_error->add( 'code', 'message', $expected ); 313 $this->wp_error->add( 'code2', 'message2', 'data2' ); 314 315 $this->assertEqualSetsWithIndex( $expected, $this->wp_error->get_error_data() ); 316 316 } 317 317 … … 320 320 */ 321 321 public function test_get_error_data_with_empty_code_and_multiple_errors_same_code_should_return_the_last_data_of_the_first_code() { 322 $this-> WP_Error->add( 'code', 'message', 'data' );323 $this-> WP_Error->add( 'code', 'message2', 'data2' );324 $this-> WP_Error->add( 'code2', 'message2', 'data3' );325 326 $this->assertSame( 'data2', $this-> WP_Error->get_error_data() );322 $this->wp_error->add( 'code', 'message', 'data' ); 323 $this->wp_error->add( 'code', 'message2', 'data2' ); 324 $this->wp_error->add( 'code2', 'message2', 'data3' ); 325 326 $this->assertSame( 'data2', $this->wp_error->get_error_data() ); 327 327 } 328 328 … … 331 331 */ 332 332 public function test_get_error_data_with_code_and_no_errors_should_evaluate_as_null() { 333 $this->assertSame( null, $this-> WP_Error->get_error_data( 'code' ) );333 $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) ); 334 334 } 335 335 … … 338 338 */ 339 339 public function test_get_error_data_with_code_and_one_error_with_no_data_should_evaluate_as_null() { 340 $this-> WP_Error->add( 'code', 'message' );341 342 $this->assertSame( null, $this-> WP_Error->get_error_data( 'code' ) );340 $this->wp_error->add( 'code', 'message' ); 341 342 $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) ); 343 343 } 344 344 … … 348 348 public function test_get_error_data_with_code_and_one_error_with_data_should_return_that_data() { 349 349 $expected = array( 'data-key' => 'data-value' ); 350 $this-> WP_Error->add( 'code', 'message', $expected );351 352 $this->assertEqualSetsWithIndex( $expected, $this-> WP_Error->get_error_data( 'code' ) );350 $this->wp_error->add( 'code', 'message', $expected ); 351 352 $this->assertEqualSetsWithIndex( $expected, $this->wp_error->get_error_data( 'code' ) ); 353 353 } 354 354 … … 358 358 public function test_get_error_data_with_code_and_multiple_errors_different_codes_should_return_the_last_stored_data_of_the_code() { 359 359 $expected = array( 'data3' ); 360 $this-> WP_Error->add( 'code', 'message', 'data' );361 $this-> WP_Error->add( 'code2', 'message2', 'data2' );362 $this-> WP_Error->add( 'code', 'message3', $expected );363 364 $this->assertEqualSetsWithIndex( $expected, $this-> WP_Error->get_error_data( 'code' ) );360 $this->wp_error->add( 'code', 'message', 'data' ); 361 $this->wp_error->add( 'code2', 'message2', 'data2' ); 362 $this->wp_error->add( 'code', 'message3', $expected ); 363 364 $this->assertEqualSetsWithIndex( $expected, $this->wp_error->get_error_data( 'code' ) ); 365 365 } 366 366 … … 369 369 */ 370 370 public function test_get_error_data_with_code_and_multiple_errors_same_code_should_return_the_last_stored_data() { 371 $this-> WP_Error->add( 'code', 'message', 'data' );372 $this-> WP_Error->add( 'code', 'message2', 'data2' );373 $this-> WP_Error->add( 'code2', 'message3', 'data3' );374 375 $this->assertSame( 'data2', $this-> WP_Error->get_error_data( 'code' ) );371 $this->wp_error->add( 'code', 'message', 'data' ); 372 $this->wp_error->add( 'code', 'message2', 'data2' ); 373 $this->wp_error->add( 'code2', 'message3', 'data3' ); 374 375 $this->assertSame( 'data2', $this->wp_error->get_error_data( 'code' ) ); 376 376 } 377 377 … … 380 380 */ 381 381 public function test_has_errors_with_no_errors_returns_false() { 382 $this->assertFalse( $this-> WP_Error->has_errors() );382 $this->assertFalse( $this->wp_error->has_errors() ); 383 383 } 384 384 … … 387 387 */ 388 388 public function test_has_errors_with_errors_returns_true() { 389 $this-> WP_Error->add( 'code', 'message', 'data' );390 $this->assertTrue( $this-> WP_Error->has_errors() );389 $this->wp_error->add( 'code', 'message', 'data' ); 390 $this->assertTrue( $this->wp_error->has_errors() ); 391 391 } 392 392 … … 395 395 */ 396 396 public function test_add_with_empty_code_empty_message_empty_data_should_add_empty_key_to_errors_array() { 397 $this-> WP_Error->add( '', '', 'data' );398 399 $this->assertArrayHasKey( '', $this-> WP_Error->errors );397 $this->wp_error->add( '', '', 'data' ); 398 399 $this->assertArrayHasKey( '', $this->wp_error->errors ); 400 400 } 401 401 … … 404 404 */ 405 405 public function test_add_with_empty_code_empty_message_empty_data_should_add_empty_message_to_errors_array_under_empty_key() { 406 $this-> WP_Error->add( '', '', 'data' );407 408 $this->assertEqualSetsWithIndex( array( '' => array( '' ) ), $this-> WP_Error->errors );406 $this->wp_error->add( '', '', 'data' ); 407 408 $this->assertEqualSetsWithIndex( array( '' => array( '' ) ), $this->wp_error->errors ); 409 409 } 410 410 … … 413 413 */ 414 414 public function test_add_with_empty_code_empty_message_empty_data_should_not_alter_data() { 415 $this-> WP_Error->add( '', '', '' );416 417 $this->assertEmpty( $this-> WP_Error->error_data );415 $this->wp_error->add( '', '', '' ); 416 417 $this->assertEmpty( $this->wp_error->error_data ); 418 418 } 419 419 … … 422 422 */ 423 423 public function test_add_with_empty_code_empty_message_non_empty_data_should_store_data_under_an_empty_code_key() { 424 $this-> WP_Error->add( '', '', 'data' );425 426 $this->assertEqualSetsWithIndex( array( '' => 'data' ), $this-> WP_Error->error_data );424 $this->wp_error->add( '', '', 'data' ); 425 426 $this->assertEqualSetsWithIndex( array( '' => 'data' ), $this->wp_error->error_data ); 427 427 } 428 428 … … 431 431 */ 432 432 public function test_add_with_code_empty_message_empty_data_should_add_error_with_code() { 433 $this-> WP_Error->add( 'code', '' );434 435 $this->assertSame( 'code', $this-> WP_Error->get_error_code() );433 $this->wp_error->add( 'code', '' ); 434 435 $this->assertSame( 'code', $this->wp_error->get_error_code() ); 436 436 } 437 437 … … 440 440 */ 441 441 public function test_add_with_code_empty_message_empty_data_should_add_error_with_empty_message() { 442 $this-> WP_Error->add( 'code', '' );443 444 $this->assertSame( '', $this-> WP_Error->get_error_message( 'code' ) );442 $this->wp_error->add( 'code', '' ); 443 444 $this->assertSame( '', $this->wp_error->get_error_message( 'code' ) ); 445 445 } 446 446 … … 449 449 */ 450 450 public function test_add_with_code_empty_message_empty_data_should_not_add_error_data() { 451 $this-> WP_Error->add( 'code', '' );452 453 $this->assertSame( null, $this-> WP_Error->get_error_data( 'code' ) );451 $this->wp_error->add( 'code', '' ); 452 453 $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) ); 454 454 } 455 455 … … 458 458 */ 459 459 public function test_add_with_code_and_message_and_empty_data_should_should_add_error_with_that_message() { 460 $this-> WP_Error->add( 'code', 'message' );461 462 $this->assertSame( 'message', $this-> WP_Error->get_error_message( 'code' ) );460 $this->wp_error->add( 'code', 'message' ); 461 462 $this->assertSame( 'message', $this->wp_error->get_error_message( 'code' ) ); 463 463 } 464 464 … … 467 467 */ 468 468 public function test_add_with_code_and_message_and_empty_data_should_not_alter_stored_data() { 469 $this-> WP_Error->add( 'code', 'message' );470 471 $this->assertSame( null, $this-> WP_Error->get_error_data( 'code' ) );469 $this->wp_error->add( 'code', 'message' ); 470 471 $this->assertSame( null, $this->wp_error->get_error_data( 'code' ) ); 472 472 } 473 473 … … 476 476 */ 477 477 public function test_add_with_code_and_empty_message_and_data_should_add_error_with_that_code() { 478 $this-> WP_Error->add( 'code', '', 'data' );479 480 $this->assertSame( 'code', $this-> WP_Error->get_error_code() );478 $this->wp_error->add( 'code', '', 'data' ); 479 480 $this->assertSame( 'code', $this->wp_error->get_error_code() ); 481 481 } 482 482 … … 485 485 */ 486 486 public function test_add_with_code_and_empty_message_and_data_should_store_that_data() { 487 $this-> WP_Error->add( 'code', '', 'data' );488 489 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );487 $this->wp_error->add( 'code', '', 'data' ); 488 489 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 490 490 } 491 491 … … 494 494 */ 495 495 public function test_add_with_code_and_message_and_data_should_add_an_error_with_that_code() { 496 $this-> WP_Error->add( 'code', 'message', 'data' );497 498 $this->assertSame( 'code', $this-> WP_Error->get_error_code() );496 $this->wp_error->add( 'code', 'message', 'data' ); 497 498 $this->assertSame( 'code', $this->wp_error->get_error_code() ); 499 499 } 500 500 … … 503 503 */ 504 504 public function test_add_with_code_and_message_and_data_should_add_an_error_with_that_message() { 505 $this-> WP_Error->add( 'code', 'message', 'data' );506 507 $this->assertSame( 'message', $this-> WP_Error->get_error_message( 'code' ) );505 $this->wp_error->add( 'code', 'message', 'data' ); 506 507 $this->assertSame( 'message', $this->wp_error->get_error_message( 'code' ) ); 508 508 } 509 509 … … 512 512 */ 513 513 public function test_add_with_code_and_message_and_data_should_store_that_data() { 514 $this-> WP_Error->add( 'code', 'message', 'data' );515 516 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );514 $this->wp_error->add( 'code', 'message', 'data' ); 515 516 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 517 517 } 518 518 … … 521 521 */ 522 522 public function test_add_multiple_times_with_the_same_code_should_add_additional_messages_for_that_code() { 523 $this-> WP_Error->add( 'code', 'message' );524 $this-> WP_Error->add( 'code', 'message2' );523 $this->wp_error->add( 'code', 'message' ); 524 $this->wp_error->add( 'code', 'message2' ); 525 525 526 526 $expected = array( 'message', 'message2' ); 527 527 528 $this->assertEqualSets( $expected, $this-> WP_Error->get_error_messages( 'code' ) );528 $this->assertEqualSets( $expected, $this->wp_error->get_error_messages( 'code' ) ); 529 529 } 530 530 … … 533 533 */ 534 534 public function test_add_multiple_times_with_the_same_code_and_different_data_should_store_only_the_last_added_data() { 535 $this-> WP_Error->add( 'code', 'message', 'data-bar' );536 $this-> WP_Error->add( 'code', 'message2', 'data-baz' );537 538 $this->assertSame( 'data-baz', $this-> WP_Error->get_error_data( 'code' ) );535 $this->wp_error->add( 'code', 'message', 'data-bar' ); 536 $this->wp_error->add( 'code', 'message2', 'data-baz' ); 537 538 $this->assertSame( 'data-baz', $this->wp_error->get_error_data( 'code' ) ); 539 539 } 540 540 … … 543 543 */ 544 544 public function test_add_data_with_empty_data_empty_code_should_create_orphaned_data_with_no_error() { 545 $this-> WP_Error->add_data( '' );546 547 $this->assertEmpty( $this-> WP_Error->errors );545 $this->wp_error->add_data( '' ); 546 547 $this->assertEmpty( $this->wp_error->errors ); 548 548 } 549 549 … … 552 552 */ 553 553 public function test_add_data_with_empty_data_empty_code_no_errors_should_create_data_under_an_empty_code_key() { 554 $this-> WP_Error->add_data( '' );555 556 $this->assertEqualSets( array( '' => '' ), $this-> WP_Error->error_data );554 $this->wp_error->add_data( '' ); 555 556 $this->assertEqualSets( array( '' => '' ), $this->wp_error->error_data ); 557 557 } 558 558 … … 561 561 */ 562 562 public function test_add_data_with_data_empty_code_and_one_error_should_store_the_data_under_that_code() { 563 $this-> WP_Error->add( 'code', 'message' );564 $this-> WP_Error->add_data( 'data' );565 566 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );563 $this->wp_error->add( 'code', 'message' ); 564 $this->wp_error->add_data( 'data' ); 565 566 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 567 567 } 568 568 … … 571 571 */ 572 572 public function test_add_data_with_data_empty_code_and_multiple_errors_with_different_codes_should_store_it_under_the_first_code() { 573 $this-> WP_Error->add( 'code', 'message' );574 $this-> WP_Error->add( 'code2', 'message2' );575 576 $this-> WP_Error->add_data( 'data' );577 578 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );573 $this->wp_error->add( 'code', 'message' ); 574 $this->wp_error->add( 'code2', 'message2' ); 575 576 $this->wp_error->add_data( 'data' ); 577 578 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 579 579 } 580 580 … … 583 583 */ 584 584 public function test_add_data_with_data_empty_code_and_multiple_errors_with_same_code_should_store_it_under_the_first_code() { 585 $this-> WP_Error->add( 'code', 'message' );586 $this-> WP_Error->add( 'code2', 'message2' );587 $this-> WP_Error->add( 'code', 'message3' );588 589 $this-> WP_Error->add_data( 'data' );590 591 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );585 $this->wp_error->add( 'code', 'message' ); 586 $this->wp_error->add( 'code2', 'message2' ); 587 $this->wp_error->add( 'code', 'message3' ); 588 589 $this->wp_error->add_data( 'data' ); 590 591 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 592 592 } 593 593 … … 596 596 */ 597 597 public function test_add_data_with_data_and_code_and_no_errors_should_create_orphaned_data_with_no_error() { 598 $this-> WP_Error->add_data( 'data', 'code' );599 600 $this->assertEmpty( $this-> WP_Error->errors );598 $this->wp_error->add_data( 'data', 'code' ); 599 600 $this->assertEmpty( $this->wp_error->errors ); 601 601 } 602 602 … … 605 605 */ 606 606 public function test_add_data_with_data_and_code_no_errors_should_create_data_under_that_code_key() { 607 $this-> WP_Error->add_data( 'data', 'code' );608 609 $this->assertEqualSets( array( 'code' => 'data' ), $this-> WP_Error->error_data );607 $this->wp_error->add_data( 'data', 'code' ); 608 609 $this->assertEqualSets( array( 'code' => 'data' ), $this->wp_error->error_data ); 610 610 } 611 611 … … 614 614 */ 615 615 public function test_add_data_with_data_and_code_one_error_different_code_should_create_orphaned_data_with_no_error() { 616 $this-> WP_Error->add( 'code', 'message' );617 618 $this-> WP_Error->add_data( 'data', 'code2' );619 620 $this->assertEqualSetsWithIndex( array( 'code' => array( 'message' ) ), $this-> WP_Error->errors );616 $this->wp_error->add( 'code', 'message' ); 617 618 $this->wp_error->add_data( 'data', 'code2' ); 619 620 $this->assertEqualSetsWithIndex( array( 'code' => array( 'message' ) ), $this->wp_error->errors ); 621 621 } 622 622 … … 625 625 */ 626 626 public function test_add_data_with_data_and_code_one_error_different_code_should_create_data_under_that_code_key() { 627 $this-> WP_Error->add( 'code', 'message' );628 629 $this-> WP_Error->add_data( 'data', 'code2' );630 631 $this->assertEqualSetsWithIndex( array( 'code2' => 'data' ), $this-> WP_Error->error_data );627 $this->wp_error->add( 'code', 'message' ); 628 629 $this->wp_error->add_data( 'data', 'code2' ); 630 631 $this->assertEqualSetsWithIndex( array( 'code2' => 'data' ), $this->wp_error->error_data ); 632 632 } 633 633 … … 636 636 */ 637 637 public function test_add_data_with_data_and_code_should_add_data() { 638 $this-> WP_Error->add( 'code', 'message' );639 640 $this-> WP_Error->add_data( 'data', 'code' );641 642 $this->assertSame( 'data', $this-> WP_Error->get_error_data( 'code' ) );638 $this->wp_error->add( 'code', 'message' ); 639 640 $this->wp_error->add_data( 'data', 'code' ); 641 642 $this->assertSame( 'data', $this->wp_error->get_error_data( 'code' ) ); 643 643 } 644 644 … … 647 647 */ 648 648 public function test_remove_with_no_errors_should_affect_nothing() { 649 $before = $this-> WP_Error->errors;650 651 $this-> WP_Error->remove( 'code' );652 653 $after = $this-> WP_Error->errors;649 $before = $this->wp_error->errors; 650 651 $this->wp_error->remove( 'code' ); 652 653 $after = $this->wp_error->errors; 654 654 655 655 $this->assertEqualSetsWithIndex( $before, $after ); … … 660 660 */ 661 661 public function test_remove_empty_code_no_errors_should_affect_nothing() { 662 $before = $this-> WP_Error->errors;663 664 $this-> WP_Error->remove( '' );665 666 $after = $this-> WP_Error->errors;662 $before = $this->wp_error->errors; 663 664 $this->wp_error->remove( '' ); 665 666 $after = $this->wp_error->errors; 667 667 668 668 $this->assertEqualSetsWithIndex( $before, $after ); … … 673 673 */ 674 674 public function test_remove_empty_code_and_one_error_with_empty_string_code_should_remove_error() { 675 $before = $this-> WP_Error->errors;676 677 $this-> WP_Error->add( '', 'message' );678 679 $this-> WP_Error->remove( '' );680 681 $after = $this-> WP_Error->errors;675 $before = $this->wp_error->errors; 676 677 $this->wp_error->add( '', 'message' ); 678 679 $this->wp_error->remove( '' ); 680 681 $after = $this->wp_error->errors; 682 682 683 683 $this->assertEqualSetsWithIndex( $before, $after ); … … 688 688 */ 689 689 public function test_remove_empty_code_and_one_error_with_empty_string_code_should_remove_error_data() { 690 $this-> WP_Error->add( '', 'message', 'data' );691 692 $this-> WP_Error->remove( '' );693 694 $after = $this-> WP_Error->error_data;695 696 $this->assertEmpty( $this-> WP_Error->error_data );690 $this->wp_error->add( '', 'message', 'data' ); 691 692 $this->wp_error->remove( '' ); 693 694 $after = $this->wp_error->error_data; 695 696 $this->assertEmpty( $this->wp_error->error_data ); 697 697 } 698 698 … … 701 701 */ 702 702 public function test_remove_should_remove_the_error_with_the_given_code() { 703 $this-> WP_Error->add( 'code', 'message' );704 705 $this-> WP_Error->remove( 'code' );706 707 $this->assertEmpty( $this-> WP_Error->errors );703 $this->wp_error->add( 'code', 'message' ); 704 705 $this->wp_error->remove( 'code' ); 706 707 $this->assertEmpty( $this->wp_error->errors ); 708 708 } 709 709 … … 712 712 */ 713 713 public function test_remove_should_remove_the_error_data_associated_with_the_given_code() { 714 $this-> WP_Error->add( 'code', 'message', 'data' );715 716 $this-> WP_Error->remove( 'code' );717 718 $this->assertEmpty( $this-> WP_Error->error_data );714 $this->wp_error->add( 'code', 'message', 'data' ); 715 716 $this->wp_error->remove( 'code' ); 717 718 $this->assertEmpty( $this->wp_error->error_data ); 719 719 } 720 720 -
trunk/tests/phpunit/tests/http/base.php
r43571 r44573 14 14 // You can use your own version of data/WPHTTP-testcase-redirection-script.php here. 15 15 var $redirection_script = 'http://api.wordpress.org/core/tests/1.0/redirection.php'; 16 var $file StreamUrl= 'http://s.w.org/screenshots/3.9/dashboard.png';16 var $file_stream_url = 'http://s.w.org/screenshots/3.9/dashboard.png'; 17 17 18 18 protected $http_request_args; … … 255 255 256 256 function test_file_stream() { 257 $url = $this->file StreamUrl;257 $url = $this->file_stream_url; 258 258 $size = 153204; 259 259 $res = wp_remote_request( … … 283 283 */ 284 284 function test_file_stream_limited_size() { 285 $url = $this->file StreamUrl;285 $url = $this->file_stream_url; 286 286 $size = 10000; 287 287 $res = wp_remote_request( … … 312 312 */ 313 313 function test_request_limited_size() { 314 $url = $this->file StreamUrl;314 $url = $this->file_stream_url; 315 315 $size = 10000; 316 316 -
trunk/tests/phpunit/tests/http/curl.php
r43571 r44573 16 16 add_action( 'http_api_curl', array( $this, '_action_test_http_api_curl_stream_parameter_is_a_reference' ), 10, 3 ); 17 17 wp_remote_request( 18 $this->file StreamUrl,18 $this->file_stream_url, 19 19 array( 20 20 'stream' => true, -
trunk/tests/phpunit/tests/user.php
r43571 r44573 200 200 */ 201 201 public function test_user_unset() { 202 // phpcs:disable WordPress.NamingConventions.ValidVariableName.NotSnakeCaseMemberVar 202 203 $user = new WP_User( self::$author_id ); 203 204 … … 208 209 $this->assertFalse( isset( $user->customField ) ); 209 210 return $user; 211 // phpcs:enable 210 212 } 211 213
Note: See TracChangeset
for help on using the changeset viewer.