Repository navigation
Tests: Use assertNotSame() for attachment JS URL comparison. - #14854
shail-mehta wants to merge 1 commit into
Conversation
Part of #64895: the prepared attachment URL is a string, so strict inequality is appropriate.
There was a problem hiding this comment.
🟢 Approval recommended
The one-line change matches the URL’s string contract and preserves the intended non-empty check.
No open issues 🎉
What changed in this PR
Updates the attachment URL test to use a strict assertion, supporting the assertion cleanup in WordPress ticket #64895.
Changes:
- Replaces
assertNotEquals()withassertNotSame()for the empty-string URL comparison. - Leaves all other assertions unchanged.
| File | Description |
|---|---|
tests/phpunit/tests/media.php |
Uses strict inequality for the prepared attachment URL check. |
Review effort: Balanced
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. 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. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
lancewillett
left a comment
There was a problem hiding this comment.
The prepared URL passes through esc_url_raw(), so the empty-string comparison preserves the existing check for this attachment fixture.
Unit-tests audit completed. Combined randomized runs passed: single-site 497 tests / 1,609 assertions; multisite 521 tests / 1,694 assertions, with one skip in each run. PHPCS and CI passed. Copilot has no open findings.
AI review · gpt-6
Use `assertNotSame()` when checking that `wp_prepare_attachment_for_js()` supplies a non-empty URL for an attachment without media. Developed in: #14854 Props shailu25. See #64895. git-svn-id: https://develop.svn.wordpress.org/trunk@64782 602fd350-edb4-49c9-b593-d223f7449a82
Use `assertNotSame()` when checking that `wp_prepare_attachment_for_js()` supplies a non-empty URL for an attachment without media. Developed in: WordPress/wordpress-develop#14854 Props shailu25. See #64895. Built from https://develop.svn.wordpress.org/trunk@64782 git-svn-id: http://core.svn.wordpress.org/trunk@63932 1a063a9b-81f0-0310-95a4-ce76da25c4cd
|
Committed at r64782 |
Part of: #64895
What
Replaces the remaining
assertNotEquals()call intests/phpunit/tests/media.phpwithassertNotSame()for the prepared attachment URL check.Updated method:
test_wp_prepare_attachment_for_js():assertNotEquals( '', $prepped['url'] )→assertNotSame( '', $prepped['url'] )Why
#64895 asks for strict assertions when both sides share a type. The prepared attachment
urlis a string, soassertNotSame()is appropriate.How
assertNotEquals()toassertNotSame()Testing instructions
npm run test:php -- --filter test_wp_prepare_attachment_for_jsUse of AI tools
Cursor