getProperty( $prop ); $p->setAccessible( true ); $p->setValue( null, null ); } } public function test_default_is_inactive(): void { $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); } public function test_enable_then_active_only_in_verify_state(): void { WPDO_Feature_Flags::enable_shadow_read( 'hot_hp_listing' ); // idle → not active even though flag is on. $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); // dual_write → still not active. WPDO_Feature_Flags::set( 'hot_hp_listing', 'dual_write' ); $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); // verify → active. WPDO_Feature_Flags::set( 'hot_hp_listing', 'verify' ); $this->assertTrue( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); // cutover → no longer active (verify-only sub-flag). WPDO_Feature_Flags::set( 'hot_hp_listing', 'cutover' ); $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); } public function test_disable_clears_active(): void { WPDO_Feature_Flags::enable_shadow_read( 'hot_hp_vendor' ); WPDO_Feature_Flags::set( 'hot_hp_vendor', 'verify' ); $this->assertTrue( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_vendor' ) ); WPDO_Feature_Flags::disable_shadow_read( 'hot_hp_vendor' ); $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_vendor' ) ); } public function test_all_shadow_returns_only_enabled_modules(): void { WPDO_Feature_Flags::enable_shadow_read( 'mod_a' ); WPDO_Feature_Flags::enable_shadow_read( 'mod_b' ); WPDO_Feature_Flags::disable_shadow_read( 'mod_b' ); $flags = WPDO_Feature_Flags::all_shadow(); $this->assertArrayHasKey( 'mod_a', $flags ); $this->assertArrayNotHasKey( 'mod_b', $flags ); } public function test_shadow_flag_independent_per_module(): void { WPDO_Feature_Flags::enable_shadow_read( 'hot_hp_listing' ); WPDO_Feature_Flags::set( 'hot_hp_listing', 'verify' ); WPDO_Feature_Flags::set( 'hot_hp_vendor', 'verify' ); $this->assertTrue( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_listing' ) ); $this->assertFalse( WPDO_Feature_Flags::is_shadow_read_active( 'hot_hp_vendor' ) ); } }