More specific test for a bad callback in `WP_Customize_Partial` test.
The 'render_callback' passed to `WP_Customize_Partial` must either echo or return a result - not both. When it's detected that the callback echoes and returns a value, the return value takes precedence. This is now reflected in the corresponding unit test. Introduced in [36586]. See #27355. See #36016. git-svn-id: https://develop.svn.wordpress.org/trunk@36784 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
f35fa3e58d
commit
603fee5749
|
@ -215,12 +215,12 @@ class Test_WP_Customize_Partial extends WP_UnitTestCase {
|
||||||
*
|
*
|
||||||
* @see WP_Customize_Partial::render()
|
* @see WP_Customize_Partial::render()
|
||||||
*/
|
*/
|
||||||
function test_render_bad_callback() {
|
function test_render_with_bad_callback_should_give_preference_to_return_value() {
|
||||||
$partial = new WP_Customize_Partial( $this->selective_refresh, 'foo', array(
|
$partial = new WP_Customize_Partial( $this->selective_refresh, 'foo', array(
|
||||||
'render_callback' => array( $this, 'render_echo_and_return' ),
|
'render_callback' => array( $this, 'render_echo_and_return' ),
|
||||||
) );
|
) );
|
||||||
$this->setExpectedIncorrectUsage( 'render' );
|
$this->setExpectedIncorrectUsage( 'render' );
|
||||||
$partial->render();
|
$this->assertSame( 'bar', $partial->render() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue