Changeset 55580
- Timestamp:
- 03/21/2023 07:58:45 PM (2 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-admin-bar.php
r54891 r55580 20 20 21 21 /** 22 * @since 3.3.0 23 * 24 * @param string $name 25 * @return string|array|void 26 */ 27 public function __get( $name ) { 28 switch ( $name ) { 29 case 'proto': 30 return is_ssl() ? 'https://' : 'http://'; 31 32 case 'menu': 33 _deprecated_argument( 'WP_Admin_Bar', '3.3.0', 'Modify admin bar nodes with WP_Admin_Bar::get_node(), WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(), not the <code>menu</code> property.' ); 34 return array(); // Sorry, folks. 35 } 36 } 22 * Deprecated menu property. 23 * 24 * @since 3.1.0 25 * @deprecated 3.3.0 Modify admin bar nodes with WP_Admin_Bar::get_node(), 26 * WP_Admin_Bar::add_node(), and WP_Admin_Bar::remove_node(). 27 * @var array 28 */ 29 public $menu = array(); 37 30 38 31 /** -
trunk/tests/phpunit/tests/adminbar.php
r54891 r55580 755 755 ); 756 756 } 757 758 /** 759 * This test ensures that WP_Admin_Bar::$proto is not defined (including magic methods). 760 * 761 * @ticket 56876 762 * @coversNothing 763 */ 764 public function test_proto_property_is_not_defined() { 765 $admin_bar = new WP_Admin_Bar(); 766 $this->assertFalse( property_exists( $admin_bar, 'proto' ), 'WP_Admin_Bar::$proto should not be defined.' ); 767 $this->assertFalse( isset( $admin_bar->proto ), 'WP_Admin_Bar::$proto should not be defined.' ); 768 } 769 770 /** 771 * This test ensures that WP_Admin_Bar::$menu is declared as a "regular" class property. 772 * 773 * @ticket 56876 774 * @coversNothing 775 */ 776 public function test_menu_property_is_defined() { 777 $admin_bar = new WP_Admin_Bar(); 778 $this->assertTrue( property_exists( $admin_bar, 'menu' ), 'WP_Admin_Bar::$proto property should be defined.' ); 779 780 $menu_property = new ReflectionProperty( WP_Admin_Bar::class, 'menu' ); 781 $this->assertTrue( $menu_property->isPublic(), 'WP_Admin_Bar::$menu should be public.' ); 782 783 $this->assertTrue( isset( $admin_bar->menu ), 'WP_Admin_Bar::$menu should be set.' ); 784 $this->assertSame( array(), $admin_bar->menu, 'WP_Admin_Bar::$menu should be equal to an empty array.' ); 785 } 757 786 }
Note: See TracChangeset
for help on using the changeset viewer.