- Timestamp:
- 01/31/2020 01:34:17 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/privacy/wpPrivacyGeneratePersonalDataExportFile.php
r46586 r47146 238 238 239 239 /** 240 * Test the export file has all the expected parts.241 * 242 * @ticket 44233 243 */ 244 public function test_ contents() {240 * Test the export HTML file has all the expected parts. 241 * 242 * @ticket 44233 243 */ 244 public function test_html_contents() { 245 245 $this->expectOutputString( '' ); 246 246 wp_privacy_generate_personal_data_export_file( self::$export_request_id ); … … 265 265 $this->assertContains( $request->email, $report_contents ); 266 266 } 267 268 /** 269 * Test the export JSON file has all the expected parts. 270 * 271 * @ticket 49029 272 */ 273 public function test_json_contents() { 274 $this->expectOutputString( '' ); 275 wp_privacy_generate_personal_data_export_file( self::$export_request_id ); 276 $this->assertTrue( file_exists( $this->export_file_name ) ); 277 278 $report_dir = trailingslashit( self::$exports_dir . 'test_contents' ); 279 mkdir( $report_dir ); 280 281 $zip = new ZipArchive(); 282 $opened_zip = $zip->open( $this->export_file_name ); 283 $this->assertTrue( $opened_zip ); 284 285 $zip->extractTo( $report_dir ); 286 $zip->close(); 287 288 $request = wp_get_user_request_data( self::$export_request_id ); 289 290 $this->assertTrue( file_exists( $report_dir . 'export.json' ) ); 291 292 $report_contents_json = file_get_contents( $report_dir . 'export.json' ); 293 294 $this->assertContains( '"Personal Data Export for ' . $request->email . '"', $report_contents_json ); 295 $this->assertContains( '"about"', $report_contents_json ); 296 } 267 297 }
Note: See TracChangeset
for help on using the changeset viewer.