refactor(2meet-data-optimizer): resolve post_type/group/table mappings through the registry
- TMDO_Post_Fields::post_type_for_group() / groups_for_post_type() derive HivePress-style groups from their registry post_type scope (core keeps its own attachment / wc_product / nav_menu_item map); the three copy-pasted switches and the query router's POST_TYPE_GROUP_MAP use them - Term/comment backfill, shadow verifier and CLI take their groups from the registry (TMDO_Term_Comment_Backfill::registered_groups()); installer drops the hp_* entries already covered by its table patterns; REST listings default post type is filterable (tmdo_rest_default_post_type, default 'post') - Verify: NoHpMappingsTest guard + mapping/default tests; core unit 640 / integration 449, HP 146/49, WC 10/22 OK - PR: PR-020e
This commit is contained in:
@@ -155,6 +155,17 @@ class RestApiTest extends TestCase {
|
||||
$this->assertIsArray( $response->get_data() );
|
||||
}
|
||||
|
||||
public function test_default_post_type_is_post_and_filterable(): void {
|
||||
$this->assertSame( 'post', WPDO_REST_API::default_post_type() );
|
||||
|
||||
$GLOBALS['_wp_filter_callbacks']['tmdo_rest_default_post_type'][] = static fn() => 'hp_listing';
|
||||
try {
|
||||
$this->assertSame( 'hp_listing', WPDO_REST_API::default_post_type() );
|
||||
} finally {
|
||||
unset( $GLOBALS['_wp_filter_callbacks']['tmdo_rest_default_post_type'] );
|
||||
}
|
||||
}
|
||||
|
||||
public function test_get_listings_rejects_unregistered_post_type(): void {
|
||||
$req = new WP_REST_Request( 'GET', '/wpdo/v1/listings' );
|
||||
$req->set_param( 'post_type', 'no_such_type' );
|
||||
|
||||
Reference in New Issue
Block a user