Changeset 46649
- Timestamp:
- 11/04/2019 12:57:17 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/pluggable.php
r46641 r46649 1252 1252 } 1253 1253 1254 if ( 300 > $status|| 399 < $status ) {1254 if ( $status < 300 || 399 < $status ) { 1255 1255 wp_die( __( 'HTTP redirect status code must be a redirection code, 3xx.' ) ); 1256 1256 } -
trunk/tests/phpunit/tests/formatting/redirect.php
r46586 r46649 19 19 function home_url() { 20 20 return 'http://example.com/'; 21 } 22 23 /** 24 * @ticket 44317 25 * 26 * @dataProvider get_bad_status_codes 27 * @expectedException WPDieException 28 * 29 * @param string $location The path or URL to redirect to. 30 * @param int $status HTTP response status code to use. 31 */ 32 public function test_wp_redirect_bad_status_code( $location, $status ) { 33 wp_redirect( $location, $status ); 34 } 35 36 public function get_bad_status_codes() { 37 return array( 38 // Tests for bad arguments 39 array( '/wp-admin', 404 ), 40 array( '/wp-admin', 410 ), 41 array( '/wp-admin', 500 ), 42 // Tests for condition. 43 array( '/wp-admin', 299 ), 44 array( '/wp-admin', 400 ), 45 ); 21 46 } 22 47 -
trunk/tests/phpunit/tests/pluggable.php
r46645 r46649 5 5 */ 6 6 class Tests_Pluggable extends WP_UnitTestCase { 7 8 /**9 * @expectedException WPDieException10 * @dataProvider get_bad_status_codes11 *12 * @ticket 4431713 * @param string $location The path or URL to redirect to.14 * @param int $status HTTP response status code to use.15 */16 public function test_wp_redirect_bad_status_code( $location, $status ) {17 wp_redirect( $location, $status );18 }19 20 public function get_bad_status_codes() {21 return [22 // Tests for bad arguments23 [ '/wp-admin', 404 ],24 [ '/wp-admin', 410 ],25 [ '/wp-admin', 500 ],26 // Tests for condition.27 [ '/wp-admin', 299 ],28 [ '/wp-admin', 400 ],29 ];30 }31 7 32 8 /**
Note: See TracChangeset
for help on using the changeset viewer.