Make WordPress Core


Ignore:
Timestamp:
09/18/2020 01:22:22 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Consistently use the expectException() method instead of the older @expectedException annotation.

See https://thephp.cc/news/2016/02/questioning-phpunit-best-practices

The method is available since PHPUnit 5.2, and WordPress currently supports PHPUnit 5.4 as the minimum version.

Follow-up to [48993].

See #51344.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/includes/helpers.php

    r48939 r48996  
    269269    /**
    270270     * @ticket 36166
    271      * @expectedException WPDieException
    272271     */
    273272    public function test_die_handler_should_handle_wp_error() {
     273        $this->expectException( 'WPDieException' );
     274
    274275        wp_die( new WP_Error( 'test', 'test' ) );
    275276    }
     
    277278    /**
    278279     * @ticket 46813
    279      * @expectedException WPDieException
    280280     */
    281281    public function test_die_handler_should_not_cause_doing_it_wrong_notice_without_wp_query_set() {
     282        $this->expectException( 'WPDieException' );
    282283        unset( $GLOBALS['wp_query'] );
    283284
Note: See TracChangeset for help on using the changeset viewer.