59710 wp privacy exports dir - #5553
Conversation
Co-authored-by: John Parris <public@johnparris.com>
Co-authored-by: John Parris <public@johnparris.com>
Co-authored-by: John Parris <public@johnparris.com>
Co-authored-by: John Parris <public@johnparris.com>
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
There was a problem hiding this comment.
Pull request overview
Adds PHPUnit coverage for wp_privacy_exports_dir() to validate its default exports directory and the wp_privacy_exports_dir filter hook behavior.
Changes:
- Introduces a new unit test file for
wp_privacy_exports_dir(). - Adds a test ensuring the
wp_privacy_exports_dirfilter can override the returned directory.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: John Parris <public@johnparris.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (2)
tests/phpunit/tests/functions/wpPrivacyExportsDir.php:2
- Missing blank line after the opening
<?phptag; other PHPUnit test files in this directory consistently include a blank line before the file header docblock, and this file currently starts the docblock immediately on the next line.
<?php
/**
tests/phpunit/tests/functions/wpPrivacyExportsDir.php:31
remove_filter()is executed after the assertion, so if the assertion fails (or an exception occurs) the filter will remain registered and can leak into subsequent tests. Wrap the assertion block in atry/finallyto guarantee cleanup.
add_filter( 'wp_privacy_exports_dir', array( $this, 'filter_wp_privacy_exports_dir' ) );
$expected_dir = '/wp-personal-data-exports-dir/';
$actual_dir = wp_privacy_exports_dir();
$this->assertSame( $expected_dir, $actual_dir );
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
tests/phpunit/tests/functions/wpPrivacyExportsDir.php:31
- The test adds the
wp_privacy_exports_dirfilter but only removes it at the end of the method. If an assertion fails (or an unexpected exception occurs), the filter will remain in place and can leak into subsequent tests, causing unrelated failures. Wrap the assertions in atry/finallyso the filter is always removed.
add_filter( 'wp_privacy_exports_dir', array( $this, 'filter_wp_privacy_exports_dir' ) );
$expected_dir = '/wp-personal-data-exports-dir/';
$actual_dir = wp_privacy_exports_dir();
$this->assertSame( $expected_dir, $actual_dir );
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
|
@pbearne Thank you! Could you check the PHP Unit Test Error? |
The filter callback was changed to derive the directory from the value passed in via str_replace(), but the expected value was left as the old hardcoded path, causing the assertion to fail. Build the expected path from the uploads basedir so it matches what the callback returns. Co-Authored-By: Claude <noreply@anthropic.com>
I have fixed this. |
|
Thank you @t-hamano appreciate we can get this out :) |
This adds coverage for the personal data exports directory, verifying both the default location under the uploads directory and that the filter of the same name can override it. Developed in: #5553 Props desrosj, masteradhoc, mindctrl, pbearne, wildworks. Fixes #59710. git-svn-id: https://develop.svn.wordpress.org/trunk@63025 602fd350-edb4-49c9-b593-d223f7449a82
This adds coverage for the personal data exports directory, verifying both the default location under the uploads directory and that the filter of the same name can override it. Developed in: WordPress/wordpress-develop#5553 Props desrosj, masteradhoc, mindctrl, pbearne, wildworks. Fixes #59710. Built from https://develop.svn.wordpress.org/trunk@63025 git-svn-id: http://core.svn.wordpress.org/trunk@62244 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/59710