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/ajax/UpdatePlugin.php

    r48939 r48996  
    1111 */
    1212class Tests_Ajax_Update_Plugin extends WP_Ajax_UnitTestCase {
    13     /**
    14      * @expectedException WPAjaxDieStopException
    15      * @expectedExceptionMessage -1
    16      */
     13
    1714    public function test_missing_nonce() {
     15        $this->setExpectedException( 'WPAjaxDieStopException', '-1' );
    1816        $this->_handleAjax( 'update-plugin' );
    1917    }
Note: See TracChangeset for help on using the changeset viewer.