[wp-trac] [WordPress Trac] #44233: Add missing unit tests for exporting personal data by username or email address

WordPress Trac noreply at wordpress.org
Thu Jun 21 15:24:40 UTC 2018


#44233: Add missing unit tests for exporting personal data by username or email
address
-------------------------+------------------------
 Reporter:  desrosj      |       Owner:  desrosj
     Type:  enhancement  |      Status:  reviewing
 Priority:  low          |   Milestone:  4.9.7
Component:  Privacy      |     Version:  4.9.6
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------

Comment (by desrosj):

 [attachment:44233.diff] combines the uncommitted tests from the three
 patches into one and contains the following changes:

 - Added a test in `wpPrivacyDeleteOldExportFiles.php` that tests file
 deletion when the expiration time period is filtered.
 - Changed `@since` tag to `4.9.7` in
 `Tests_Privacy_WpPrivacyProcessPersonalDataExportPage` and
 `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile` classes. Not sure
 if this `@since` should match the function or test introduction version
 (thinking the test).
 - Removed variable declarations for `$filtered_response` in test methods
 that did not utilize the variable in
 `wpPrivacyProcessPersonalDataExportPage`.
 - Move `register_custom_personal_data_exporters()` closer to the top of
 the class `Tests_Privacy_WpPrivacyProcessPersonalDataExportPage` class
 where it is used.
 - Add a skip condition to
 `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile->setUp()`
 - Replace `@unlink()` call with a `wp_delete_file()` call.
 - Move `$exception_was_thrown` variables in each test method within the
 `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile` class to a class
 property to avoid repeating in every method.
 - Added checks that the export file was actually created for success
 scenario test methods in the
 `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile` class.
 - Log the created export file on the `` action in a class property within
 the `Tests_Privacy_wpPrivacyGeneratePersonalDataExportFile` class and use
 it to test that the file exists after calling the function.

 I set up a [https://travis-ci.org/desrosj/wordpress-
 develop/builds/395055138 branch on my `wordpress-develop` fork to show the
 tests passing].

 Remaining items:
 - There are some PHP 5.2 failures that I am looking into.
 - The
 `test_wp_privacy_generate_personal_data_export_file_detects_cannot_create_index()`
 and
 `test_wp_privacy_generate_personal_data_export_file_detects_cannot_write_html()`
 test methods are failing locally for me but passing on Travis. I think
 this is permissions related. Going to look into a more system independent
 way to set up these test methods.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/44233#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list