Media: Update get_post_galleries() to return Gallery Blocks.#1864
Closed
costdev wants to merge 32 commits intoWordPress:trunkfrom
Closed
Media: Update get_post_galleries() to return Gallery Blocks.#1864costdev wants to merge 32 commits intoWordPress:trunkfrom
get_post_galleries() to return Gallery Blocks.#1864costdev wants to merge 32 commits intoWordPress:trunkfrom
Conversation
added 7 commits
October 29, 2021 16:05
2ab53eb to
7dc550a
Compare
costdev
commented
Nov 11, 2021
00d192f to
e1127ac
Compare
added 5 commits
November 11, 2021 21:35
added 9 commits
November 15, 2021 08:40
…-existing test methods.
- Adds more assertions to cause test failures instead of fatal errors. - Adds comments for the additional assertions where necessary.
added 2 commits
November 16, 2021 10:00
`foreach` was not detecting the changed length of `$post_blocks`. A `while` loop does detect this.
This assertion checked the first three elements of the actual value. It should have been checking the last three elements. See the assertion in `test_post_gallery_images()`, on which this new test method is based.
hellofromtonya
approved these changes
Nov 16, 2021
Contributor
hellofromtonya
left a comment
There was a problem hiding this comment.
Great job @costdev and @glendaviesnz 🎉 The PR to handle both v1 and v2 gallery block looks ready for commit 👍
Contributor
|
Committed via changeset https://core.trac.wordpress.org/changeset/52190. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Galleries in Gutenberg don't use the
[gallery]shortcode, so they are not returned byget_post_galleries().This change makes
get_post_galleries()also check for Gallery blocks and return them.Trac ticket: https://core.trac.wordpress.org/ticket/43826
Tasks
src/wp-includes/media.php
tests/phpunit/media.php
assertEquals()in favour of stricter options.expectedandactualvalues in tests added in this PR.get_post_galleries()tests to a separate file:tests/phpunit/tests/media/getPostGalleries.php.tests/phpunit/media/getPostGalleries.php
@coversannotation to test class.@groupannotations for each test method.expectedandactualvalues in pre-existing test methods.messageparameters to test methods with multiple assertions.assertSame()toassertSameSetsWithIndex().get_post_galleries().Tests: Reduce the number of test methods by using data providers where possible.Data providers deferred until a later review of the test suite.