Make WordPress Core

Changeset 899 in tests


Ignore:
Timestamp:
07/10/2012 09:23:19 PM (12 years ago)
Author:
nacin
Message:

Admin bar: When calling add_node() for an existing node, all properties should be merged into the existing arguments, including individual meta arguments. see #WP21117.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/test_includes_admin_bar.php

    r898 r899  
    77 */
    88class TestWPAdminBar extends WP_UnitTestCase {
     9
     10    static function setUpBeforeClass() {
     11        WP_UnitTestCase::setUpBeforeClass();
     12        require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
     13    }
     14
    915    function setUp() {
    1016        parent::setUp();
     
    2430        register_post_type( 'content', array( 'show_in_admin_bar' => true ) );
    2531
    26         require_once ABSPATH . WPINC . '/class-wp-admin-bar.php';
    2732        $admin_bar = new WP_Admin_Bar;
    2833
     
    3641    }
    3742
     43    /**
     44     * @ticket 21117
     45     */
     46    function test_merging_existing_meta_values() {
     47        $admin_bar = new WP_Admin_Bar;
     48
     49        $admin_bar->add_node( array(
     50            'id' => 'test-node',
     51            'meta' => array( 'class' => 'test-class' ),
     52        ) );
     53        $node = $admin_bar->get_node( 'test-node' );
     54        $this->assertEquals( array( 'class' => 'test-class' ), $node->meta );
     55
     56        $admin_bar->add_node( array(
     57            'id' => 'test-node',
     58            'meta' => array( 'some-meta' => 'value' ),
     59        ) );
     60
     61        $node = $admin_bar->get_node( 'test-node' );
     62        $this->assertEquals( array( 'class' => 'test-class', 'some-meta' => 'value' ), $node->meta );
     63    }
    3864}
Note: See TracChangeset for help on using the changeset viewer.