WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/18/2020 01:48:27 PM (7 months ago)
Author:
SergeyBiryukov
Message:

Tests: Switch Ajax tests to use the expectException() method directly, instead of the WP_UnitTestCase_Base::setExpectedException() wrapper.

This brings some consistency with other tests.

Follow-up to [48996].

See #51344.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/ajax/ReplytoComment.php

    r48937 r48997  
    114114
    115115        // Make the request.
    116         $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
     116        $this->expectException( 'WPAjaxDieStopException' );
     117        $this->expectExceptionMessage( '-1' );
    117118        $this->_handleAjax( 'replyto-comment' );
    118119    }
     
    143144
    144145        // Make the request.
    145         $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
     146        $this->expectException( 'WPAjaxDieStopException' );
     147        $this->expectExceptionMessage( '-1' );
    146148        $this->_handleAjax( 'replyto-comment' );
    147149    }
     
    163165
    164166        // Make the request.
    165         $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
     167        $this->expectException( 'WPAjaxDieStopException' );
     168        $this->expectExceptionMessage( '-1' );
    166169        $this->_handleAjax( 'replyto-comment' );
    167170    }
     
    183186
    184187        // Make the request.
    185         $this->setExpectedException( 'WPAjaxDieStopException', 'Error: You can’t reply to a comment on a draft post.' );
     188        $this->expectException( 'WPAjaxDieStopException' );
     189        $this->expectExceptionMessage( 'Error: You can’t reply to a comment on a draft post.' );
    186190        $this->_handleAjax( 'replyto-comment' );
    187191    }
     
    253257
    254258        // Make the request.
    255         $this->setExpectedException( 'WPAjaxDieStopException', 'pre_comment_approved filter fails for new comment' );
     259        $this->expectException( 'WPAjaxDieStopException' );
     260        $this->expectExceptionMessage( 'pre_comment_approved filter fails for new comment.' );
    256261        $this->_handleAjax( 'replyto-comment' );
    257262    }
     
    261266     */
    262267    function _pre_comment_approved_filter( $approved, $commentdata ) {
    263         return new WP_Error( 'comment_wrong', 'pre_comment_approved filter fails for new comment', 403 );
     268        return new WP_Error( 'comment_wrong', 'pre_comment_approved filter fails for new comment.', 403 );
    264269    }
    265270}
Note: See TracChangeset for help on using the changeset viewer.