createMock( TMDO_Entity_Adapter_Interface::class ) ); } public function test_plan_lists_shared_keys_whose_legacy_owner_is_another_group(): void { TMDO_Entity_Registry::register_group( 'post', 'listing', array( array( 'key' => 'shared', 'type' => 'text' ), array( 'key' => 'price', 'type' => 'decimal' ) ), array( 'post_types' => array( 'hp_listing' ) ) ); TMDO_Entity_Registry::register_group( 'post', 'vendor', array( array( 'key' => 'shared', 'type' => 'text' ) ), array( 'post_types' => array( 'hp_vendor' ) ) ); $this->assertSame( array( array( 'target' => 'listing', 'source' => 'vendor', 'key' => 'shared', 'post_types' => array( 'hp_listing' ), ), ), TMDO_Post_Group_Reconciler::plan() ); } public function test_unscoped_groups_and_unshared_keys_need_no_move(): void { TMDO_Entity_Registry::register_group( 'post', 'site', array( array( 'key' => '_edit_lock', 'type' => 'text' ) ) ); TMDO_Entity_Registry::register_group( 'post', 'listing', array( array( 'key' => 'price', 'type' => 'decimal' ) ), array( 'post_types' => array( 'hp_listing' ) ) ); $this->assertSame( array(), TMDO_Post_Group_Reconciler::plan() ); } public function test_registry_exposes_group_post_types(): void { TMDO_Entity_Registry::register_group( 'post', 'listing', array( array( 'key' => 'price', 'type' => 'decimal' ) ), array( 'post_types' => array( 'hp_listing' ) ) ); TMDO_Entity_Registry::register_group( 'post', 'site', array( array( 'key' => '_edit_lock', 'type' => 'text' ) ) ); $this->assertSame( array( 'hp_listing' ), TMDO_Entity_Registry::get_group_post_types( 'post', 'listing' ) ); $this->assertSame( array(), TMDO_Entity_Registry::get_group_post_types( 'post', 'site' ) ); TMDO_Entity_Registry::init(); $this->assertSame( array(), TMDO_Entity_Registry::get_group_post_types( 'post', 'listing' ) ); } }