getProperty( 'instance' ); $prop->setAccessible( true ); $prop->setValue( null, null ); $this->adapter = new WPDO_HivePress_Memberships_Adapter(); } public function test_implements_adapter_interface(): void { $this->assertInstanceOf( WPDO_HivePress_Adapter::class, $this->adapter ); } public function test_identity(): void { $this->assertSame( 'hivepress-memberships', $this->adapter->plugin_slug() ); $this->assertSame( 'HivePress\\Memberships\\Plugin', $this->adapter->detection_class() ); $this->assertSame( 'HIVEPRESS_MEMBERSHIPS_VERSION', $this->adapter->detection_const() ); $this->assertSame( '2.0.0', $this->adapter->minimum_addon_version() ); } public function test_on_register_fields_registers_three_hot_fields(): void { $registry = WPDO_Schema_Registry::instance(); $this->adapter->on_register_fields( $registry ); // Plan fields. $expire_period = $registry->get_field( 'hp_membership_plan', 'hp_expire_period' ); $this->assertSame( 'hot', $expire_period['zone'] ); $this->assertStringContainsString( 'int', $expire_period['data_type'] ); $primary = $registry->get_field( 'hp_membership_plan', 'hp_primary' ); $this->assertSame( 'hot', $primary['zone'] ); $this->assertTrue( (bool) $primary['indexed'] ); // Membership field — the hottest path. $expired = $registry->get_field( 'hp_membership', 'hp_expired_time' ); $this->assertSame( 'hot', $expired['zone'] ); $this->assertTrue( (bool) $expired['indexed'] ); $this->assertStringContainsString( 'bigint', $expired['data_type'] ); } public function test_doctor_check_reports_missing_tables_in_stub_env(): void { $result = $this->adapter->doctor_check(); $this->assertFalse( $result['ok'] ); $this->assertArrayHasKey( 'hp_membership_plan', $result['details'] ); $this->assertArrayHasKey( 'hp_membership', $result['details'] ); } public function test_score_aggregates_to_perfect_ten(): void { $score = $this->adapter->suitability_score(); $this->assertSame( 10.0, $score['aggregate'] ); } public function test_migrations_lists_both_hot_modules(): void { $mods = $this->adapter->migrations(); $this->assertContains( 'hot_hp_membership_plan', $mods ); $this->assertContains( 'hot_hp_membership', $mods ); } }