Make WordPress Core

Changeset 44792


Ignore:
Timestamp:
03/04/2019 10:19:05 PM (5 years ago)
Author:
desrosj
Message:

Privacy: Remove two test methods that fail on certain configurations.

The test_detects_cannot_create_index() and tests_detects_cannot_write_html() test methods are prone to failure under certain configurations, as discovered by the hosts reporting back the test suite results. This removes those two methods until a better approach to testing those scenarios can be created.

Partial revert of [44786].
See #44233.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php

    r44786 r44792  
    215215
    216216    /**
    217      * When the index.html file cannot be created an error should be displayed.
    218      *
    219      * @ticket 44233
    220      */
    221     public function test_detects_cannot_create_index() {
    222         // Make the export directory read only so the index.html file can't be created.
    223         mkdir( self::$exports_dir );
    224         chmod( self::$exports_dir, 0444 );
    225 
    226         if ( '444' !== substr( decoct( fileperms( self::$exports_dir ) ), -3 ) ) {
    227             $this->markTestSkipped( 'Data export directory permissions were not changed correctly.' );
    228         }
    229 
    230         $this->setExpectedException( 'WPDieException' );
    231         $this->expectOutputString( '{"success":false,"data":"Unable to protect export folder from browsing."}' );
    232         wp_privacy_generate_personal_data_export_file( self::$export_request_id );
    233     }
    234 
    235     /**
    236217     * Test that an index.html file can be added to the export directory.
    237218     *
     
    243224
    244225        $this->assertTrue( file_exists( self::$exports_dir . 'index.html' ) );
    245     }
    246 
    247     /**
    248      * When the export directory is not writable the report should fail to write.
    249      *
    250      * @ticket 44233
    251      */
    252     public function test_detects_cannot_write_html() {
    253         // Make the folder read only so HTML writing will fail.
    254         mkdir( self::$exports_dir );
    255         touch( self::$exports_dir . 'index.html' );
    256         chmod( self::$exports_dir, 0555 );
    257 
    258         if ( '555' !== substr( decoct( fileperms( self::$exports_dir ) ), -3 ) ) {
    259             $this->markTestSkipped( 'Data export directory permissions were not changed correctly.' );
    260         }
    261 
    262         $this->setExpectedException( 'WPDieException' );
    263         $this->expectOutputString( '{"success":false,"data":"Unable to open export file (HTML report) for writing."}' );
    264         wp_privacy_generate_personal_data_export_file( self::$export_request_id );
    265 
    266         $this->assertEmpty( $this->export_file_name );
    267226    }
    268227
Note: See TracChangeset for help on using the changeset viewer.