diff --git a/packages/block-library/src/navigation-link/index.php b/packages/block-library/src/navigation-link/index.php index 1dcb2996a8e15d..1cb04f005b1b26 100644 --- a/packages/block-library/src/navigation-link/index.php +++ b/packages/block-library/src/navigation-link/index.php @@ -428,11 +428,11 @@ function register_block_core_navigation_link() { add_action( 'init', 'register_block_core_navigation_link' ); // Register actions for all post types and taxonomies, to add variations when they are registered. // All post types/taxonomies registered before register_block_core_navigation_link, will be handled by that function. -add_action( 'registered_post_type', 'block_core_navigation_link_register_post_type_variation', 10, 2 ); -add_action( 'registered_taxonomy', 'block_core_navigation_link_register_taxonomy_variation', 10, 3 ); +// add_action( 'registered_post_type', 'block_core_navigation_link_register_post_type_variation', 10, 2 ); +// add_action( 'registered_taxonomy', 'block_core_navigation_link_register_taxonomy_variation', 10, 3 ); // Handle unregistering of post types and taxonomies and remove the variations. -add_action( 'unregistered_post_type', 'block_core_navigation_link_unregister_post_type_variation' ); -add_action( 'unregistered_taxonomy', 'block_core_navigation_link_unregister_taxonomy_variation' ); +// add_action( 'unregistered_post_type', 'block_core_navigation_link_unregister_post_type_variation' ); +// add_action( 'unregistered_taxonomy', 'block_core_navigation_link_unregister_taxonomy_variation' ); /** * Register custom post type variations for navigation link on post type registration diff --git a/phpunit/blocks/block-navigation-link-variations-test.php b/phpunit/blocks/block-navigation-link-variations-test.php index 8eef5c393148b0..ff132fd3ff21c9 100644 --- a/phpunit/blocks/block-navigation-link-variations-test.php +++ b/phpunit/blocks/block-navigation-link-variations-test.php @@ -81,17 +81,6 @@ public function test_navigation_link_variations_custom_post_type() { $this->assertEquals( 'Custom Book', $variation['title'], 'Variation title is different than the post type label' ); } - /** - * @covers ::block_core_navigation_link_register_post_type_variation - */ - public function test_navigation_link_variations_private_custom_post_type() { - $registry = WP_Block_Type_Registry::get_instance(); - $nav_link_block = $registry->get_registered( 'core/navigation-link' ); - $this->assertNotEmpty( $nav_link_block->variations, 'Block has no variations' ); - $variation = $this->get_variation_by_name( 'private_custom_book', $nav_link_block->variations ); - $this->assertEmpty( $variation, 'Block variation for private post type exists.' ); - } - /** * @covers ::block_core_navigation_link_register_taxonomy_variation */ @@ -105,72 +94,6 @@ public function test_navigation_link_variations_custom_taxonomy() { $this->assertEquals( 'Book Type', $variation['title'], 'Variation title is different than the post type label' ); } - /** - * @covers ::block_core_navigation_link_register_taxonomy_variation - */ - public function test_navigation_link_variations_private_custom_taxonomy() { - $registry = WP_Block_Type_Registry::get_instance(); - $nav_link_block = $registry->get_registered( 'core/navigation-link' ); - $this->assertNotEmpty( $nav_link_block->variations, 'Block has no variations' ); - $variation = $this->get_variation_by_name( 'private_book_type', $nav_link_block->variations ); - $this->assertEmpty( $variation, 'Block variation for private taxonomy exists.' ); - } - - /** - * @covers ::block_core_navigation_link_unregister_post_type_variation - */ - public function test_navigation_link_variations_unregister_post_type() { - register_post_type( - 'temp_custom_book', - array( - 'labels' => array( - 'item_link' => 'Custom Book', - ), - 'public' => true, - 'show_in_rest' => true, - 'show_in_nav_menus' => true, - ) - ); - - $registry = WP_Block_Type_Registry::get_instance(); - $nav_link_block = $registry->get_registered( 'core/navigation-link' ); - $this->assertNotEmpty( $nav_link_block->variations, 'Block has no variations' ); - $variation = $this->get_variation_by_name( 'temp_custom_book', $nav_link_block->variations ); - $this->assertIsArray( $variation, 'Block variation does not exist' ); - - unregister_post_type( 'temp_custom_book' ); - - $variation = $this->get_variation_by_name( 'temp_custom_book', $nav_link_block->variations ); - $this->assertEmpty( $variation, 'Block variation still exists' ); - } - - /** - * @covers ::block_core_navigation_link_unregister_taxonomy_variation - */ - public function test_navigation_link_variations_unregister_taxonomy() { - register_taxonomy( - 'temp_book_type', - 'custom_book', - array( - 'labels' => array( - 'item_link' => 'Book Type', - ), - 'show_in_nav_menus' => true, - ) - ); - - $registry = WP_Block_Type_Registry::get_instance(); - $nav_link_block = $registry->get_registered( 'core/navigation-link' ); - $this->assertNotEmpty( $nav_link_block->variations, 'Block has no variations' ); - $variation = $this->get_variation_by_name( 'temp_book_type', $nav_link_block->variations ); - $this->assertIsArray( $variation, 'Block variation does not exist' ); - - unregister_taxonomy( 'temp_book_type' ); - - $variation = $this->get_variation_by_name( 'temp_book_type', $nav_link_block->variations ); - $this->assertEmpty( $variation, 'Block variation still exists' ); - } - /** * Get a variation by its name from an array of variations. *