[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 Sep 13 17:39: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.9
Component: Privacy | Version: 4.9.6
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-------------------------+------------------------
Comment (by iandunn):
r43640 commits the changes to `wpPrivacyDeleteOldExportFiles.php`. The
other two files look pretty good, but need a few more changes.
I did some minor cleanup in [attachment:"44233.6.diff"]:
* Minor coding standards issues
* Removing comments that didn't feel necessary because the code was
descriptive on its own.
* Prefixing the (global) function name with `::` in the `@covers`
annotation, so PHPUnit's code coverage can find the function
The one big change I made was to remove the `try...catch` blocks (and
related code) in favor of the existing `WPDieException` /
`setExpectedException()` pattern used elsewhere in the suite. The avoids
the problem mentioned in comment:18, and makes the code smaller and easier
to read. `setExpectedException()` was deprecated in PHPUnit `7`, but Core
already has a shim for it that calls `expectException()`. This should be
back-compat with PHPUnit `3.7` and forward-compat with `7.x`, but so far
I've only tested on `6.5`.
I left a few questions in the diff, marked with `todo`. @desrosj,
@birgire, can y'all take a look at those? There's mostly small docs
issues. The only big change I think this might need is to refactor
`wpPrivacyProcessPersonalDataExportPage.php` to use a `@dataProvider`, to
avoid having a ton of tests with duplicated code.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/44233#comment:24>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list