Skip to content

Blocks: Ensure string return value from render_callback#4879

Merged
aduth merged 1 commit intomasterfrom
update/dynamic-render-cast-string
Feb 7, 2018
Merged

Blocks: Ensure string return value from render_callback#4879
aduth merged 1 commit intomasterfrom
update/dynamic-render-cast-string

Conversation

@aduth
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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