Repository navigation
Tests: Resolve gallery attachment IDs after fixture setup - #14832
benitoalba wants to merge 1 commit into
Conversation
|
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:
|
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes correct fixture timing and strengthen regression coverage without changing production behavior or rejection expectations.
No open issues 🎉
What changed in this PR
This test-only follow-up to #14443 fixes gallery attachment IDs being read before fixtures are initialized and strengthens coverage of the AJAX media-shortcode response.
Changes:
- Resolve
%dplaceholders during test execution, after fixture setup. - Add an unrelated attachment and verify that only the intended caption appears.
- Preserve all three datasets’ existing success and rejection expectations.
| File | Description |
|---|---|
tests/phpunit/tests/ajax/wpAjaxParseMediaShortcode.php |
Defer attachment ID substitution and add assertions against unrelated gallery content. |
Review effort: Balanced
Resolve the gallery shortcode's attachment ID during test execution instead of in the data provider, which runs before fixture setup. Add an unrelated attachment and assert that the response includes only the intended caption. Preserve the existing success and rejection expectations for all three shortcode cases. Developed in: #14832 Props benitoalba. See #66211. git-svn-id: https://develop.svn.wordpress.org/trunk@64747 602fd350-edb4-49c9-b593-d223f7449a82
|
PR #14832 landed in https://core.trac.wordpress.org/changeset/64747 |
Resolve the gallery shortcode's attachment ID during test execution instead of in the data provider, which runs before fixture setup. Add an unrelated attachment and assert that the response includes only the intended caption. Preserve the existing success and rejection expectations for all three shortcode cases. Developed in: WordPress/wordpress-develop#14832 Props benitoalba. See #66211. Built from https://develop.svn.wordpress.org/trunk@64747 git-svn-id: http://core.svn.wordpress.org/trunk@63897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
shortcode_provider()runs beforewpSetUpBeforeClass(), so the gallery datasets contain[gallery ids=" "]instead of the attachment ID. The allowed gallery case still succeeds, but adding a second attachment shows that its response can include unrelated media.Return
%dplaceholders from the provider and fill them in when the test runs, after fixture setup. Add an unrelated attachment and check that the allowed gallery includes the intended caption and excludes the other one. All three datasets keep their existing success and rejection expectations.This follows the optional follow-up on #14443. The fixture issue predates the conversion to a static provider.
Trac ticket: https://core.trac.wordpress.org/ticket/66211
Testing
Tested on PHP 8.3.36 with PHPUnit 9.6.36 and MariaDB:
66211): 190 tests and 1,113 assertions on single site; 202 tests and 805 assertions on multisite. Each run skips one test.git diff --checkpass.Use of AI Tools
AI assistance: Yes. OpenAI Codex researched the follow-up, wrote the change and assertions, ran local validation, and drafted this description.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.