Make WordPress Core

Changeset 36784


Ignore:
Timestamp:
02/29/2016 09:53:18 PM (9 years ago)
Author:
boonebgorges
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/partial.php

    r36689 r36784  
    216216     * @see WP_Customize_Partial::render()
    217217     */
    218     function test_render_bad_callback() {
     218    function test_render_with_bad_callback_should_give_preference_to_return_value() {
    219219        $partial = new WP_Customize_Partial( $this->selective_refresh, 'foo', array(
    220220            'render_callback' => array( $this, 'render_echo_and_return' ),
    221221        ) );
    222222        $this->setExpectedIncorrectUsage( 'render' );
    223         $partial->render();
     223        $this->assertSame( 'bar', $partial->render() );
    224224    }
    225225
Note: See TracChangeset for help on using the changeset viewer.