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/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    r48236 r48996  
    164164        $request_id = wp_create_user_request( 'removal-requester@example.com', 'remove_personal_data' );
    165165
    166         $this->setExpectedException( 'WPDieException' );
     166        $this->expectException( 'WPDieException' );
    167167        $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating export file."}' );
    168168        wp_privacy_generate_personal_data_export_file( $request_id );
     
    175175     */
    176176    public function test_invalid_request_id() {
    177         $this->setExpectedException( 'WPDieException' );
     177        $this->expectException( 'WPDieException' );
    178178        $this->expectOutputString( '{"success":false,"data":"Invalid request ID when generating export file."}' );
    179179        wp_privacy_generate_personal_data_export_file( 123456789 );
     
    195195        );
    196196
    197         $this->setExpectedException( 'WPDieException' );
     197        $this->expectException( 'WPDieException' );
    198198        $this->expectOutputString( '{"success":false,"data":"Invalid email address when generating export file."}' );
    199199        wp_privacy_generate_personal_data_export_file( $request_id );
     
    209209        touch( untrailingslashit( self::$exports_dir ) );
    210210
    211         $this->setExpectedException( 'WPDieException' );
     211        $this->expectException( 'WPDieException' );
    212212        $this->expectOutputString( '{"success":false,"data":"Unable to create export folder."}' );
    213213        wp_privacy_generate_personal_data_export_file( self::$export_request_id );
Note: See TracChangeset for help on using the changeset viewer.