mirrored from git://develop.git.wordpress.org/
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media: Update get_post_galleries()
to return Gallery Blocks.
#1864
Closed
Conversation
This file contains 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
costdev
force-pushed
the
#43826
branch
2 times, most recently
from
November 11, 2021 07:19
2ab53eb
to
7dc550a
Compare
costdev
commented
Nov 11, 2021
costdev
force-pushed
the
#43826
branch
3 times, most recently
from
November 11, 2021 20:43
00d192f
to
e1127ac
Compare
…-existing test methods.
- Adds more assertions to cause test failures instead of fatal errors. - Adds comments for the additional assertions where necessary.
`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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @costdev and @glendaviesnz 🎉 The PR to handle both v1 and v2 gallery block looks ready for commit
👍
Committed via changeset https://core.trac.wordpress.org/changeset/52190. |
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.expected
andactual
values 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
@covers
annotation to test class.@group
annotations for each test method.expected
andactual
values in pre-existing test methods.message
parameters 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.