Skip to content

59710 wp privacy exports dir - #5553

Closed
pbearne wants to merge 18 commits into
WordPress:trunkfrom
pbearne:59710_wp_privacy_exports_dir
Closed

59710 wp privacy exports dir#5553
pbearne wants to merge 18 commits into
WordPress:trunkfrom
pbearne:59710_wp_privacy_exports_dir

Conversation

@pbearne

@pbearne pbearne commented Oct 23, 2023

Copy link
Copy Markdown

Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
pbearne and others added 5 commits June 26, 2026 14:01
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>
@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props pbearne, wildworks, mindctrl, masteradhoc.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
@masteradhoc

Copy link
Copy Markdown

@pbearne could you check the last feedback from @mindctrl? i'd like to milestone this for 7.1 so we can get this added soon.

Copilot AI review requested due to automatic review settings July 28, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_dir filter can override the returned directory.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Co-authored-by: John Parris <public@johnparris.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 29, 2026 20:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 <?php tag; 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 a try/finally to 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 );

Copilot AI review requested due to automatic review settings July 29, 2026 20:04

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_dir filter 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 a try/finally so 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 );

Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php Outdated
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php
Comment thread tests/phpunit/tests/functions/wpPrivacyExportsDir.php
Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com>
@masteradhoc

Copy link
Copy Markdown

@pbearne Thank you! Could you check the PHP Unit Test Error?

There was 1 failure:

1) Tests_Functions_wpPrivacyExportsDir::test_wp_privacy_exports_dir_filtered
Failed asserting that two strings are identical.
--- Expected
+++ Actual
@@ @@
-'/wp-personal-data-exports-dir/'
+'/var/www/src/wp-content/uploads/filtered-exports/'

/var/www/tests/phpunit/tests/functions/wpPrivacyExportsDir.php:28
phpvfscomposer:///var/www/vendor/phpunit/phpunit/phpunit:106
/var/www/vendor/bin/phpunit:118

t-hamano and others added 2 commits August 5, 2026 16:56
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>
@t-hamano

t-hamano commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Could you check the PHP Unit Test Error?

I have fixed this.

@masteradhoc

Copy link
Copy Markdown

Thank you @t-hamano appreciate we can get this out :)

pento pushed a commit that referenced this pull request Aug 5, 2026
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
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 63025
GitHub commit: 7d6fa3a

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Aug 5, 2026
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Aug 5, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants