Skip to content
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

Blocks: Ensure string return value from render_callback #4879

Merged
merged 1 commit into from
Feb 7, 2018

Conversation

aduth
Copy link
Member

@aduth aduth commented Feb 5, 2018

See: #4716 (comment)

This pull request seeks to update and verify the behavior of WP_Block_Type to ensure a string return value from its render function, as documented in inline code docs.

Testing instructions:

Verify PHPUnit tests pass:

phpunit

cc @tfrommen

@aduth aduth added the [Feature] Block API API that allows to express the block paradigm. label Feb 5, 2018
Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our CI tests were failing but I restarted the job and now they are passing. The changes look good to me 👍

@aduth aduth merged commit 264a899 into master Feb 7, 2018
@aduth aduth deleted the update/dynamic-render-cast-string branch February 7, 2018 23:09
@johnbillion
Copy link
Member

The test_dynamic_block_renders_string() test is useless as it will pass without the (string) cast in place. assertSame() needs to be used in place of assertEquals() to assert that the type is the same, or, preferably, assertInternalType( 'string', ... ).

@aduth
Copy link
Member Author

aduth commented Feb 19, 2018

Oof, good catch @johnbillion, I wrongly expected assertEquals to be a strict equality check. I'll open a follow-up pull request.

@johnbillion
Copy link
Member

Yeah it's an annoying one, that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants