Make WordPress Core


Ignore:
Timestamp:
11/04/2019 12:57:17 PM (7 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Adjust the test for wp_redirect() status codes added in [46641] per the documentation and coding standards.

Move the test to a more appropriate place for consistency with wp_sanitize_redirect() and wp_validate_redirect() tests.

See #44317.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/pluggable.php

    r46645 r46649  
    55 */
    66class Tests_Pluggable extends WP_UnitTestCase {
    7 
    8         /**
    9          * @expectedException WPDieException
    10          * @dataProvider get_bad_status_codes
    11          *
    12          * @ticket 44317
    13          * @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 arguments
    23                         [ '/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         }
    317
    328        /**
Note: See TracChangeset for help on using the changeset viewer.