refactor(2meet-data-optimizer): stop registering the sso group in core
- TMDO_Member_Fields no longer registers user/sso; the definition moved unchanged (hash 03543f19) to 2meet-data-optimizer-sso-addon. - missing_integration_addons(): 2meet-hub-core or 2meet-spoke-sso without the SSO AddOn is reported (admin notice + Site Health). - The deprecated-AddOn notice points hub / spoke users to the SSO AddOn. - Sites must activate the SSO AddOn before this ships (PR-041); aeav_only sites without it fall back to orphan-group restore. - Verify: core unit 659 / integration 475, SSO 6, HP 142/49, WC 10/22 green, phpcs clean - PR: PR-040
This commit is contained in:
@@ -43,6 +43,17 @@ class DeprecatedAddonsNoticeTest extends TestCase {
|
||||
$this->assertStringContainsString( 'PARTNER-REGISTRATION.md', $html );
|
||||
}
|
||||
|
||||
public function test_hub_and_spoke_point_to_the_sso_addon(): void {
|
||||
$GLOBALS['_wp_options']['active_plugins'] = array( '2meet-data-optimizer-spoke-addon/2meet-data-optimizer-spoke-addon.php' );
|
||||
|
||||
ob_start();
|
||||
TMDO_Deprecated_Addons_Notice::render();
|
||||
$html = (string) ob_get_clean();
|
||||
|
||||
$this->assertStringContainsString( '2meet-data-optimizer-spoke-addon', $html );
|
||||
$this->assertStringContainsString( '2meet-data-optimizer-sso-addon', $html );
|
||||
}
|
||||
|
||||
public function test_no_notice_when_none_active_or_user_cannot_manage(): void {
|
||||
ob_start();
|
||||
TMDO_Deprecated_Addons_Notice::render();
|
||||
|
||||
@@ -39,12 +39,18 @@ class MemberFieldsRegistrationTest extends TestCase {
|
||||
public function test_all_four_groups_are_registered(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
|
||||
foreach ( array( 'membership', 'activity', 'profile', 'sso' ) as $group ) {
|
||||
foreach ( array( 'membership', 'activity', 'profile' ) as $group ) {
|
||||
$fields = WPDO_Entity_Registry::get_group_fields( 'user', $group );
|
||||
$this->assertNotEmpty( $fields, "Group '{$group}' should have registered fields." );
|
||||
}
|
||||
}
|
||||
|
||||
public function test_core_leaves_the_sso_group_to_the_sso_addon(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
|
||||
$this->assertSame( array(), WPDO_Entity_Registry::get_group_fields( 'user', 'sso' ) );
|
||||
}
|
||||
|
||||
public function test_core_registers_no_hp_user_group(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
|
||||
@@ -148,41 +154,6 @@ class MemberFieldsRegistrationTest extends TestCase {
|
||||
$this->assertTrue( (bool) $field['fulltext'] );
|
||||
}
|
||||
|
||||
// ── sso group ────────────────────────────────────────────────────────────
|
||||
|
||||
public function test_sso_group_has_eight_fields(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
$fields = WPDO_Entity_Registry::get_group_fields( 'user', 'sso' );
|
||||
// v3.4.4: known_login_ips registered (was leaking to wp_usermeta via set_entity).
|
||||
$this->assertCount( 8, $fields );
|
||||
$this->assertNotNull( $this->find_field( $fields, 'known_login_ips' ) );
|
||||
}
|
||||
|
||||
public function test_hub_global_user_id_is_searchable(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
$fields = WPDO_Entity_Registry::get_group_fields( 'user', 'sso' );
|
||||
$field = $this->find_field( $fields, 'hub_global_user_id' );
|
||||
|
||||
$this->assertTrue( (bool) $field['searchable'] );
|
||||
}
|
||||
|
||||
public function test_token_expires_at_is_datetime_searchable(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
$fields = WPDO_Entity_Registry::get_group_fields( 'user', 'sso' );
|
||||
$field = $this->find_field( $fields, 'token_expires_at' );
|
||||
|
||||
$this->assertSame( 'datetime', $field['type'] );
|
||||
$this->assertTrue( (bool) $field['searchable'] );
|
||||
}
|
||||
|
||||
public function test_refresh_token_enc_is_textarea(): void {
|
||||
WPDO_Member_Fields::register_entity_fields();
|
||||
$fields = WPDO_Entity_Registry::get_group_fields( 'user', 'sso' );
|
||||
$field = $this->find_field( $fields, 'refresh_token_enc' );
|
||||
|
||||
$this->assertSame( 'textarea', $field['type'] );
|
||||
}
|
||||
|
||||
// ── register() hooks add_action ──────────────────────────────────────────
|
||||
|
||||
public function test_register_hooks_wpdo_register_entity_fields(): void {
|
||||
|
||||
@@ -79,6 +79,27 @@ class MissingIntegrationAddonsTest extends TestCase {
|
||||
$this->assertSame( array( 'WooCommerce' => '2meet-data-optimizer-woocommerce-addon' ), TMDO_Compatibility::missing_integration_addons() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_hub_or_spoke_without_the_sso_addon_is_reported(): void {
|
||||
eval( 'final class TMSO_Plugin {}' );
|
||||
|
||||
$this->assertSame( array( '2meet Hub / Spoke SSO' => '2meet-data-optimizer-sso-addon' ), TMDO_Compatibility::missing_integration_addons() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
*/
|
||||
public function test_hub_with_the_sso_addon_is_fine(): void {
|
||||
eval( 'final class TMHC_Plugin {}' );
|
||||
eval( 'final class TMDO_SSO_Integration {}' );
|
||||
|
||||
$this->assertSame( array(), TMDO_Compatibility::missing_integration_addons() );
|
||||
}
|
||||
|
||||
/**
|
||||
* @runInSeparateProcess
|
||||
* @preserveGlobalState disabled
|
||||
|
||||
Reference in New Issue
Block a user