Changeset 44792
- Timestamp:
- 03/04/2019 10:19:05 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
r44786 r44792 215 215 216 216 /** 217 * When the index.html file cannot be created an error should be displayed.218 *219 * @ticket 44233220 */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 /**236 217 * Test that an index.html file can be added to the export directory. 237 218 * … … 243 224 244 225 $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 44233251 */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 );267 226 } 268 227
Note: See TracChangeset
for help on using the changeset viewer.