Make WordPress Core


Ignore:
Timestamp:
09/18/2020 01:53:31 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Update the code example in WP_Ajax_UnitTestCase::dieHandler() DocBlock to use expectException().

Follow-up to [48996], [48997].

See #51344.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-ajax.php

    r47122 r48998  
    197197         * Save the output for analysis, stop execution by throwing an exception.
    198198         *
    199          * Error conditions (no output, just die) will throw <code>WPAjaxDieStopException( $message )</code>
     199         * Error conditions (no output, just die) will throw <code>WPAjaxDieStopException( $message )</code>.
    200200         * You can test for this with:
    201201         * <code>
    202          * $this->setExpectedException( 'WPAjaxDieStopException', 'something contained in $message' );
     202         * $this->expectException( 'WPAjaxDieStopException' );
     203         * $this->expectExceptionMessage( 'something contained in $message' );
    203204         * </code>
    204          * Normal program termination (wp_die called at then end of output) will throw <code>WPAjaxDieContinueException( $message )</code>
     205         *
     206         * Normal program termination (wp_die called at the end of output) will throw <code>WPAjaxDieContinueException( $message )</code>.
    205207         * You can test for this with:
    206208         * <code>
    207          * $this->setExpectedException( 'WPAjaxDieContinueException', 'something contained in $message' );
     209         * $this->expectException( 'WPAjaxDieContinueException' );
     210         * $this->expectExceptionMessage( 'something contained in $message' );
    208211         * </code>
    209212         *
Note: See TracChangeset for help on using the changeset viewer.