Changeset 58183
- Timestamp:
- 05/22/2024 03:39:51 PM (5 months ago)
- Location:
- trunk/tests/phpunit/tests/editor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/editor/classic-to-block-menu-converter.php
r56971 r58183 32 32 $this->assertTrue( is_wp_error( $result ), 'Should be a WP_Error instance' ); 33 33 34 $this->assert Equals( 'invalid_menu', $result->get_error_code(), 'Error code should indicate invalidity of menu argument.' );35 36 $this->assert Equals( 'The menu provided is not a valid menu.', $result->get_error_message(), 'Error message should communicate invalidity of menu argument.' );34 $this->assertSame( 'invalid_menu', $result->get_error_code(), 'Error code should indicate invalidity of menu argument.' ); 35 36 $this->assertSame( 'The menu provided is not a valid menu.', $result->get_error_message(), 'Error message should communicate invalidity of menu argument.' ); 37 37 } 38 38 … … 105 105 $nested_block = $parsed_blocks[1]['innerBlocks'][0]; 106 106 107 $this->assert Equals( 'core/navigation-link', $first_block['blockName'], 'First block name should be "core/navigation-link"' );108 109 $this->assert Equals( 'Classic Menu Item 1', $first_block['attrs']['label'], 'First block label should match.' );110 111 $this->assert Equals( '/classic-menu-item-1', $first_block['attrs']['url'], 'First block URL should match.' );107 $this->assertSame( 'core/navigation-link', $first_block['blockName'], 'First block name should be "core/navigation-link"' ); 108 109 $this->assertSame( 'Classic Menu Item 1', $first_block['attrs']['label'], 'First block label should match.' ); 110 111 $this->assertSame( '/classic-menu-item-1', $first_block['attrs']['url'], 'First block URL should match.' ); 112 112 113 113 // Assert parent of nested menu item is a submenu block. 114 $this->assert Equals( 'core/navigation-submenu', $second_block['blockName'], 'Second block name should be "core/navigation-submenu"' );115 116 $this->assert Equals( 'Classic Menu Item 2', $second_block['attrs']['label'], 'Second block label should match.' );117 118 $this->assert Equals( '/classic-menu-item-2', $second_block['attrs']['url'], 'Second block URL should match.' );119 120 $this->assert Equals( 'core/navigation-link', $nested_block['blockName'], 'Nested block name should be "core/navigation-link"' );121 122 $this->assert Equals( 'Nested Menu Item 1', $nested_block['attrs']['label'], 'Nested block label should match.' );123 124 $this->assert Equals( '/nested-menu-item-1', $nested_block['attrs']['url'], 'Nested block URL should match.' );114 $this->assertSame( 'core/navigation-submenu', $second_block['blockName'], 'Second block name should be "core/navigation-submenu"' ); 115 116 $this->assertSame( 'Classic Menu Item 2', $second_block['attrs']['label'], 'Second block label should match.' ); 117 118 $this->assertSame( '/classic-menu-item-2', $second_block['attrs']['url'], 'Second block URL should match.' ); 119 120 $this->assertSame( 'core/navigation-link', $nested_block['blockName'], 'Nested block name should be "core/navigation-link"' ); 121 122 $this->assertSame( 'Nested Menu Item 1', $nested_block['attrs']['label'], 'Nested block label should match.' ); 123 124 $this->assertSame( '/nested-menu-item-1', $nested_block['attrs']['url'], 'Nested block URL should match.' ); 125 125 126 126 wp_delete_nav_menu( $menu_id ); … … 195 195 $this->assertCount( 1, $parsed_blocks, 'Should only be one block in the array.' ); 196 196 197 $this->assert Equals( 'core/navigation-link', $parsed_blocks[0]['blockName'], 'First block name should be "core/navigation-link"' );198 199 $this->assert Equals( 'Classic Menu Item 1', $parsed_blocks[0]['attrs']['label'], 'First block label should match.' );200 201 $this->assert Equals( '/classic-menu-item-1', $parsed_blocks[0]['attrs']['url'], 'First block URL should match.' );197 $this->assertSame( 'core/navigation-link', $parsed_blocks[0]['blockName'], 'First block name should be "core/navigation-link"' ); 198 199 $this->assertSame( 'Classic Menu Item 1', $parsed_blocks[0]['attrs']['label'], 'First block label should match.' ); 200 201 $this->assertSame( '/classic-menu-item-1', $parsed_blocks[0]['attrs']['url'], 'First block URL should match.' ); 202 202 203 203 wp_delete_nav_menu( $menu_id ); -
trunk/tests/phpunit/tests/editor/navigation-fallback.php
r56971 r58183 46 46 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 47 47 48 $this->assert Equals( 'wp_navigation', $data->post_type, 'Fallback menu type should be `wp_navigation`' );49 50 $this->assert Equals( 'Navigation', $data->post_title, 'Fallback menu title should be the default fallback title' );51 52 $this->assert Equals( 'navigation', $data->post_name, 'Fallback menu slug (post_name) should be the default slug' );53 54 $this->assert Equals( '<!-- wp:page-list /-->', $data->post_content );48 $this->assertSame( 'wp_navigation', $data->post_type, 'Fallback menu type should be `wp_navigation`' ); 49 50 $this->assertSame( 'Navigation', $data->post_title, 'Fallback menu title should be the default fallback title' ); 51 52 $this->assertSame( 'navigation', $data->post_name, 'Fallback menu slug (post_name) should be the default slug' ); 53 54 $this->assertSame( '<!-- wp:page-list /-->', $data->post_content ); 55 55 56 56 $navs_in_db = $this->get_navigations_in_database(); … … 93 93 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 94 94 95 $this->assertNot Equals( '<!-- wp:page-list /-->', $data->post_content, 'Navigation Menu should not contain a Page List block.' );95 $this->assertNotSame( '<!-- wp:page-list /-->', $data->post_content, 'Navigation Menu should not contain a Page List block.' ); 96 96 97 97 $this->assertEmpty( $data->post_content, 'Menu should be empty.' ); … … 114 114 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 115 115 116 $this->assert Equals( 'Navigation', $data->post_title, 'Fallback menu title should be the default title' );116 $this->assertSame( 'Navigation', $data->post_title, 'Fallback menu title should be the default title' ); 117 117 118 118 $navs_in_db = $this->get_navigations_in_database(); … … 147 147 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 148 148 149 $this->assert Equals( $most_recently_published_nav->post_title, $data->post_title, 'Fallback menu title should be the same as the most recently created menu.' );150 151 $this->assert Equals( $most_recently_published_nav->post_name, $data->post_name, 'Post name should be the same as the most recently created menu.' );152 153 $this->assert Equals( $most_recently_published_nav->post_content, $data->post_content, 'Post content should be the same as the most recently created menu.' );149 $this->assertSame( $most_recently_published_nav->post_title, $data->post_title, 'Fallback menu title should be the same as the most recently created menu.' ); 150 151 $this->assertSame( $most_recently_published_nav->post_name, $data->post_name, 'Post name should be the same as the most recently created menu.' ); 152 153 $this->assertSame( $most_recently_published_nav->post_content, $data->post_content, 'Post content should be the same as the most recently created menu.' ); 154 154 155 155 // Check that no new Navigation menu was created. … … 180 180 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 181 181 182 $this->assert Equals( 'Existing Classic Menu', $data->post_title, 'Fallback menu title should be the same as the classic menu.' );182 $this->assertSame( 'Existing Classic Menu', $data->post_title, 'Fallback menu title should be the same as the classic menu.' ); 183 183 184 184 // Assert that the fallback contains a navigation-link block. … … 234 234 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 235 235 236 $this->assert Equals( 'Classic Menu in Primary Location', $data->post_title, 'Fallback menu title should match the menu in the "primary" location.' );236 $this->assertSame( 'Classic Menu in Primary Location', $data->post_title, 'Fallback menu title should match the menu in the "primary" location.' ); 237 237 } 238 238 … … 272 272 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 273 273 274 $this->assert Equals( 'Primary', $data->post_title, 'Fallback menu title should match the menu with the slug "primary".' );274 $this->assertSame( 'Primary', $data->post_title, 'Fallback menu title should match the menu with the slug "primary".' ); 275 275 } 276 276 … … 310 310 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 311 311 312 $this->assert Equals( 'Most Recent Classic Menu', $data->post_title, 'Fallback menu title should match the menu that was created most recently.' );312 $this->assertSame( 'Most Recent Classic Menu', $data->post_title, 'Fallback menu title should match the menu that was created most recently.' ); 313 313 } 314 314 … … 342 342 $this->assertInstanceOf( 'WP_Post', $data, 'Response should be of the correct type.' ); 343 343 344 $this->assert Equals( $existing_navigation_menu->post_title, $data->post_title, 'Fallback menu title should be the same as the existing Navigation menu.' );345 346 $this->assertNot Equals( 'Existing Classic Menu', $data->post_title, 'Fallback menu title should not be the same as the Classic Menu.' );344 $this->assertSame( $existing_navigation_menu->post_title, $data->post_title, 'Fallback menu title should be the same as the existing Navigation menu.' ); 345 346 $this->assertNotSame( 'Existing Classic Menu', $data->post_title, 'Fallback menu title should not be the same as the Classic Menu.' ); 347 347 348 348 // Check that only a single Navigation fallback was created.
Note: See TracChangeset
for help on using the changeset viewer.