Changeset 52010 for trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
- Timestamp:
- 11/04/2021 03:22:47 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/xmlrpc/wp/newPost.php
r51968 r52010 6 6 class Tests_XMLRPC_wp_newPost extends WP_XMLRPC_UnitTestCase { 7 7 8 function test_invalid_username_password() {8 public function test_invalid_username_password() { 9 9 $result = $this->myxmlrpcserver->wp_newPost( array( 1, 'username', 'password', array() ) ); 10 10 $this->assertIXRError( $result ); … … 12 12 } 13 13 14 function test_incapable_user() {14 public function test_incapable_user() { 15 15 $this->make_user_by_role( 'subscriber' ); 16 16 … … 20 20 } 21 21 22 function test_no_content() { 23 if ( PHP_VERSION_ID >= 80100 ) { 24 /* 25 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 26 * via hooked in filter functions until a more structural solution to the 27 * "missing input validation" conundrum has been architected and implemented. 28 */ 29 $this->expectDeprecation(); 30 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 31 } 32 22 public function test_no_content() { 33 23 $this->make_user_by_role( 'author' ); 34 24 … … 39 29 } 40 30 41 function test_basic_content() { 42 if ( PHP_VERSION_ID >= 80100 ) { 43 /* 44 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 45 * via hooked in filter functions until a more structural solution to the 46 * "missing input validation" conundrum has been architected and implemented. 47 */ 48 $this->expectDeprecation(); 49 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 50 } 51 31 public function test_basic_content() { 52 32 $this->make_user_by_role( 'author' ); 53 33 … … 58 38 } 59 39 60 function test_ignore_id() { 61 if ( PHP_VERSION_ID >= 80100 ) { 62 /* 63 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 64 * via hooked in filter functions until a more structural solution to the 65 * "missing input validation" conundrum has been architected and implemented. 66 */ 67 $this->expectDeprecation(); 68 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 69 } 70 40 public function test_ignore_id() { 71 41 $this->make_user_by_role( 'author' ); 72 42 … … 80 50 } 81 51 82 function test_capable_publish() { 83 if ( PHP_VERSION_ID >= 80100 ) { 84 /* 85 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 86 * via hooked in filter functions until a more structural solution to the 87 * "missing input validation" conundrum has been architected and implemented. 88 */ 89 $this->expectDeprecation(); 90 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 91 } 92 52 public function test_capable_publish() { 93 53 $this->make_user_by_role( 'author' ); 94 54 … … 101 61 } 102 62 103 function test_incapable_publish() {63 public function test_incapable_publish() { 104 64 $this->make_user_by_role( 'contributor' ); 105 65 … … 113 73 } 114 74 115 function test_capable_private() { 116 if ( PHP_VERSION_ID >= 80100 ) { 117 /* 118 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 119 * via hooked in filter functions until a more structural solution to the 120 * "missing input validation" conundrum has been architected and implemented. 121 */ 122 $this->expectDeprecation(); 123 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 124 } 125 75 public function test_capable_private() { 126 76 $this->make_user_by_role( 'editor' ); 127 77 … … 134 84 } 135 85 136 function test_incapable_private() {86 public function test_incapable_private() { 137 87 $this->make_user_by_role( 'contributor' ); 138 88 … … 146 96 } 147 97 148 function test_capable_other_author() { 149 if ( PHP_VERSION_ID >= 80100 ) { 150 /* 151 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 152 * via hooked in filter functions until a more structural solution to the 153 * "missing input validation" conundrum has been architected and implemented. 154 */ 155 $this->expectDeprecation(); 156 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 157 } 158 98 public function test_capable_other_author() { 159 99 $other_author_id = $this->make_user_by_role( 'author' ); 160 100 $this->make_user_by_role( 'editor' ); … … 168 108 } 169 109 170 function test_incapable_other_author() {110 public function test_incapable_other_author() { 171 111 $other_author_id = $this->make_user_by_role( 'author' ); 172 112 $this->make_user_by_role( 'contributor' ); … … 181 121 } 182 122 183 function test_invalid_author() {123 public function test_invalid_author() { 184 124 $this->make_user_by_role( 'editor' ); 185 125 … … 193 133 } 194 134 195 function test_empty_author() { 196 if ( PHP_VERSION_ID >= 80100 ) { 197 /* 198 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 199 * via hooked in filter functions until a more structural solution to the 200 * "missing input validation" conundrum has been architected and implemented. 201 */ 202 $this->expectDeprecation(); 203 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 204 } 205 135 public function test_empty_author() { 206 136 $my_author_id = $this->make_user_by_role( 'author' ); 207 137 … … 219 149 * @requires function imagejpeg 220 150 */ 221 function test_post_thumbnail() {151 public function test_post_thumbnail() { 222 152 add_theme_support( 'post-thumbnails' ); 223 153 … … 239 169 } 240 170 241 function test_invalid_post_status() { 242 if ( PHP_VERSION_ID >= 80100 ) { 243 /* 244 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 245 * via hooked in filter functions until a more structural solution to the 246 * "missing input validation" conundrum has been architected and implemented. 247 */ 248 $this->expectDeprecation(); 249 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 250 } 251 171 public function test_invalid_post_status() { 252 172 $this->make_user_by_role( 'author' ); 253 173 … … 261 181 } 262 182 263 function test_incapable_sticky() {183 public function test_incapable_sticky() { 264 184 $this->make_user_by_role( 'contributor' ); 265 185 … … 273 193 } 274 194 275 function test_capable_sticky() { 276 if ( PHP_VERSION_ID >= 80100 ) { 277 /* 278 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 279 * via hooked in filter functions until a more structural solution to the 280 * "missing input validation" conundrum has been architected and implemented. 281 */ 282 $this->expectDeprecation(); 283 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 284 } 285 195 public function test_capable_sticky() { 286 196 $this->make_user_by_role( 'editor' ); 287 197 … … 295 205 } 296 206 297 function test_private_sticky() {207 public function test_private_sticky() { 298 208 $this->make_user_by_role( 'editor' ); 299 209 … … 308 218 } 309 219 310 function test_post_format() { 311 if ( PHP_VERSION_ID >= 80100 ) { 312 /* 313 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 314 * via hooked in filter functions until a more structural solution to the 315 * "missing input validation" conundrum has been architected and implemented. 316 */ 317 $this->expectDeprecation(); 318 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 319 } 320 220 public function test_post_format() { 321 221 $this->make_user_by_role( 'editor' ); 322 222 … … 330 230 } 331 231 332 function test_invalid_post_format() { 333 if ( PHP_VERSION_ID >= 80100 ) { 334 /* 335 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 336 * via hooked in filter functions until a more structural solution to the 337 * "missing input validation" conundrum has been architected and implemented. 338 */ 339 $this->expectDeprecation(); 340 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 341 } 342 232 public function test_invalid_post_format() { 343 233 $this->make_user_by_role( 'editor' ); 344 234 … … 352 242 } 353 243 354 function test_invalid_taxonomy() {244 public function test_invalid_taxonomy() { 355 245 $this->make_user_by_role( 'editor' ); 356 246 … … 376 266 } 377 267 378 function test_invalid_term_id() {268 public function test_invalid_term_id() { 379 269 $this->make_user_by_role( 'editor' ); 380 270 … … 390 280 } 391 281 392 function test_terms() { 393 if ( PHP_VERSION_ID >= 80100 ) { 394 /* 395 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 396 * via hooked in filter functions until a more structural solution to the 397 * "missing input validation" conundrum has been architected and implemented. 398 */ 399 $this->expectDeprecation(); 400 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 401 } 402 282 public function test_terms() { 403 283 $this->make_user_by_role( 'editor' ); 404 284 … … 425 305 } 426 306 427 function test_terms_names() { 428 if ( PHP_VERSION_ID >= 80100 ) { 429 /* 430 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 431 * via hooked in filter functions until a more structural solution to the 432 * "missing input validation" conundrum has been architected and implemented. 433 */ 434 $this->expectDeprecation(); 435 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 436 } 437 307 public function test_terms_names() { 438 308 $this->make_user_by_role( 'editor' ); 439 309 … … 478 348 * @ticket 28601 479 349 */ 480 function test_invalid_post_date_does_not_fatal() { 481 if ( PHP_VERSION_ID >= 80100 ) { 482 /* 483 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 484 * via hooked in filter functions until a more structural solution to the 485 * "missing input validation" conundrum has been architected and implemented. 486 */ 487 $this->expectDeprecation(); 488 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 489 } 490 350 public function test_invalid_post_date_does_not_fatal() { 491 351 $this->make_user_by_role( 'author' ); 492 352 $date_string = 'invalid_date'; … … 505 365 * @ticket 28601 506 366 */ 507 function test_invalid_post_date_gmt_does_not_fatal() { 508 if ( PHP_VERSION_ID >= 80100 ) { 509 /* 510 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 511 * via hooked in filter functions until a more structural solution to the 512 * "missing input validation" conundrum has been architected and implemented. 513 */ 514 $this->expectDeprecation(); 515 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 516 } 517 367 public function test_invalid_post_date_gmt_does_not_fatal() { 518 368 $this->make_user_by_role( 'author' ); 519 369 $date_string = 'invalid_date'; … … 532 382 * @ticket 28601 533 383 */ 534 function test_valid_string_post_date() { 535 if ( PHP_VERSION_ID >= 80100 ) { 536 /* 537 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 538 * via hooked in filter functions until a more structural solution to the 539 * "missing input validation" conundrum has been architected and implemented. 540 */ 541 $this->expectDeprecation(); 542 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 543 } 544 384 public function test_valid_string_post_date() { 545 385 $this->make_user_by_role( 'author' ); 546 386 $date_string = '1984-01-11 05:00:00'; … … 559 399 * @ticket 28601 560 400 */ 561 function test_valid_string_post_date_gmt() { 562 if ( PHP_VERSION_ID >= 80100 ) { 563 /* 564 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 565 * via hooked in filter functions until a more structural solution to the 566 * "missing input validation" conundrum has been architected and implemented. 567 */ 568 $this->expectDeprecation(); 569 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 570 } 571 401 public function test_valid_string_post_date_gmt() { 572 402 $this->make_user_by_role( 'author' ); 573 403 $date_string = '1984-01-11 05:00:00'; … … 586 416 * @ticket 28601 587 417 */ 588 function test_valid_IXR_post_date() { 589 if ( PHP_VERSION_ID >= 80100 ) { 590 /* 591 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 592 * via hooked in filter functions until a more structural solution to the 593 * "missing input validation" conundrum has been architected and implemented. 594 */ 595 $this->expectDeprecation(); 596 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 597 } 598 418 public function test_valid_IXR_post_date() { 599 419 $this->make_user_by_role( 'author' ); 600 420 $date_string = '1984-01-11 05:00:00'; … … 613 433 * @ticket 28601 614 434 */ 615 function test_valid_IXR_post_date_gmt() { 616 if ( PHP_VERSION_ID >= 80100 ) { 617 /* 618 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 619 * via hooked in filter functions until a more structural solution to the 620 * "missing input validation" conundrum has been architected and implemented. 621 */ 622 $this->expectDeprecation(); 623 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 624 } 625 435 public function test_valid_IXR_post_date_gmt() { 626 436 $this->make_user_by_role( 'author' ); 627 437 $date_string = '1984-01-11 05:00:00';
Note: See TracChangeset
for help on using the changeset viewer.