From 603fee57492663e9c7aa679d528cfc7c7ab1c66a Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Mon, 29 Feb 2016 21:53:18 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/customize/partial.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/customize/partial.php b/tests/phpunit/tests/customize/partial.php index 66cdfdb90f..2609c7e3fd 100644 --- a/tests/phpunit/tests/customize/partial.php +++ b/tests/phpunit/tests/customize/partial.php @@ -215,12 +215,12 @@ class Test_WP_Customize_Partial extends WP_UnitTestCase { * * @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( 'render_callback' => array( $this, 'render_echo_and_return' ), ) ); $this->setExpectedIncorrectUsage( 'render' ); - $partial->render(); + $this->assertSame( 'bar', $partial->render() ); } /**