getProperty( 'instance' ); $prop->setAccessible( true ); $prop->setValue( null, null ); unset( $GLOBALS['_wp_options']['hp_vendor_social_links'], $GLOBALS['_wp_options']['hp_listing_social_links'] ); $this->adapter = new WPDO_HivePress_Social_Links_Adapter(); } public function test_implements_adapter_interface(): void { $this->assertInstanceOf( WPDO_HivePress_Adapter::class, $this->adapter ); } public function test_identity(): void { $this->assertSame( 'hivepress-social-links', $this->adapter->plugin_slug() ); $this->assertSame( 'HivePress\\SocialLinks\\Plugin', $this->adapter->detection_class() ); } public function test_registers_enabled_links_per_model(): void { // hivepress-social-links stores each enabled link as the attribute hp_{name}, // with separate admin selections for listings and vendors. update_option( 'hp_vendor_social_links', array( 'facebook', 'website' ) ); update_option( 'hp_listing_social_links', array( 'instagram' ) ); $registry = WPDO_Schema_Registry::instance(); $this->adapter->on_register_fields( $registry ); $this->assertSame( 'cold', $registry->get_field( 'hp_vendor', 'hp_facebook' )['zone'] ); $this->assertSame( 'cold', $registry->get_field( 'hp_vendor', 'hp_website' )['zone'] ); $this->assertSame( 'cold', $registry->get_field( 'hp_listing', 'hp_instagram' )['zone'] ); $this->assertNull( $registry->get_field( 'hp_vendor', 'hp_instagram' ) ); $this->assertNull( $registry->get_field( 'hp_vendor', 'hp_facebook_url' ) ); } public function test_registers_nothing_when_no_links_enabled(): void { $registry = WPDO_Schema_Registry::instance(); $this->adapter->on_register_fields( $registry ); $this->assertNull( $registry->get_field( 'hp_vendor', 'hp_facebook' ) ); $this->assertNull( $registry->get_field( 'hp_listing', 'hp_facebook' ) ); } public function test_doctor_check_reports_registered_count(): void { update_option( 'hp_vendor_social_links', array( 'facebook', 'website' ) ); update_option( 'hp_listing_social_links', array( 'instagram' ) ); $result = $this->adapter->doctor_check(); $this->assertTrue( $result['ok'] ); $this->assertStringContainsString( '3 cold fields', $result['message'] ); } public function test_score_aggregates_to_perfect_ten(): void { $this->assertSame( 10.0, $this->adapter->suitability_score()['aggregate'] ); } }