Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-classic-to-block-menu-converter.php
r56257 r56422 21 21 * 22 22 * @param WP_Term $menu The Menu term object of the menu to convert. 23 * @return string the serialized and normalized parsed blocks. 23 * @return string|WP_Error The serialized and normalized parsed blocks on success, 24 * an empty string when there are no menus to convert, 25 * or WP_Error on invalid menu. 24 26 */ 25 27 public static function convert( $menu ) { … … 35 37 36 38 if ( empty( $menu_items ) ) { 37 return array();39 return ''; 38 40 } 39 41 -
trunk/src/wp-includes/class-wp-navigation-fallback.php
r56414 r56422 106 106 $classic_nav_menu_blocks = WP_Classic_To_Block_Menu_Converter::convert( $classic_nav_menu ); 107 107 108 if ( is_wp_error( $classic_nav_menu_blocks ) ) { 109 return $classic_nav_menu_blocks; 110 } 111 108 112 if ( empty( $classic_nav_menu_blocks ) ) { 109 113 return new WP_Error( 'cannot_convert_classic_menu', __( 'Unable to convert Classic Menu to blocks.' ) ); -
trunk/tests/phpunit/tests/editor/classic-to-block-menu-converter.php
r56052 r56422 206 206 * @covers WP_Classic_To_Block_Menu_Converter::convert 207 207 */ 208 public function test_returns_empty_ array_for_menus_with_no_items() {208 public function test_returns_empty_string_for_menus_with_no_items() { 209 209 $menu_id = wp_create_nav_menu( 'Empty Menu' ); 210 210 … … 213 213 $blocks = WP_Classic_To_Block_Menu_Converter::convert( $classic_nav_menu ); 214 214 215 $this->assertEmpty( $blocks, 'Result should be empty.' ); 216 217 $this->assertIsArray( $blocks, 'Result should be empty array.' ); 215 $this->assertSame( '', $blocks, 'Result should be empty string.' ); 218 216 219 217 wp_delete_nav_menu( $menu_id );
Note: See TracChangeset
for help on using the changeset viewer.