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/formatting/redirect.php

    r46586 r46649  
    1919        function home_url() {
    2020                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                );
    2146        }
    2247
Note: See TracChangeset for help on using the changeset viewer.