Taxonomy: add taxonomy for user pattern categories.

Adds a `wp_pattern_category` taxonomy linked to the `wp-block` object.

Props glendaviesnz, kebbet, desrosj, mamaduka.
Fixes #59379.


git-svn-id: https://develop.svn.wordpress.org/trunk@56642 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Isabel Brison
2023-09-21 04:23:12 +00:00
parent c531947f3b
commit 2c2924089d
4 changed files with 426 additions and 1 deletions

View File

@@ -186,6 +186,8 @@ class WP_Test_REST_Schema_Initialization extends WP_Test_REST_TestCase {
'/wp-site-health/v1/tests/authorization-header',
'/wp-site-health/v1/tests/page-cache',
'/wp-site-health/v1/directory-sizes',
'/wp/v2/wp_pattern_category',
'/wp/v2/wp_pattern_category/(?P<id>[\d]+)',
);
$this->assertSameSets( $expected_routes, $routes );

View File

@@ -12,6 +12,10 @@ class Tests_Taxonomy extends WP_UnitTestCase {
$this->assertSame( array( 'link_category' ), get_object_taxonomies( 'link' ) );
}
public function test_get_block_taxonomies() {
$this->assertSame( array( 'wp_pattern_category' ), get_object_taxonomies( 'wp_block' ) );
}
/**
* @ticket 5417
*/
@@ -119,6 +123,7 @@ class Tests_Taxonomy extends WP_UnitTestCase {
$this->assertTrue( taxonomy_exists( 'category' ) );
$this->assertTrue( taxonomy_exists( 'post_tag' ) );
$this->assertTrue( taxonomy_exists( 'link_category' ) );
$this->assertTrue( taxonomy_exists( 'wp_pattern_category' ) );
}
public function test_taxonomy_exists_unknown() {