Skip to content

Tests: Add unit test coverage for wp_is_writable() - #14667

Open
shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:65819/tests-wp-is-writable
Open

shail-mehta wants to merge 1 commit into
WordPress:trunkfrom
shail-mehta:65819/tests-wp-is-writable

Conversation

@shail-mehta

Copy link
Copy Markdown
Member

What

Trac ticket: #65819

Adds unit tests for wp_is_writable() in tests/phpunit/tests/functions/wpIsWritable.php.

Why

wp_is_writable() has no dedicated unit tests. Adding coverage for this helper fills that gap under #65819.

How

New test class covering:

  • writable temp directory → true
  • missing path → false
  • writable temp file → true

Test-only; no production code changes.

Testing Instructions

  1. npm run test:php -- --filter Tests_Functions_wpIsWritable
  2. npm run test:php -- --filter Tests_Functions_wpIsWritable -c tests/phpunit/multisite.xml
  3. npm run test:php -- --filter Tests_Functions_wpIsWritable --order-by=random
  4. npm run test:php -- --group functions

Use of AI Tools

  • Cursor

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.

🟢 Approval recommended

Static review identified no blocking issues in the focused test-only changes; tests were not executed.

No open issues 🎉

What changed in this PR

Adds dedicated unit coverage for wp_is_writable() under Trac #65819, without changing production code.

Changes:

  • Tests writable temporary directories and files.
  • Tests that a path with a missing parent returns false, accounting for Windows behavior.
File Description
tests/​phpunit/​tests/​functions/​wpIsWritable.php Adds three focused tests for wp_is_writable().

Review effort: Balanced

@shail-mehta
shail-mehta marked this pull request as ready for review October 21, 2026 17:54
@github-actions

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 shailu25.

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

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.

2 participants