'dual_write' ) ); $uid = TMDO_Live_Fixtures::user(); $prefs = array( 'core' => array( 'welcomeGuide' => false ) ); $loc = array( 'ip' => '192.0.2.0' ); update_user_meta( $uid, 'wp_persisted_preferences', $prefs ); update_user_meta( $uid, 'community-events-location', $loc ); tmdo_live_assert_same( serialize( $prefs ), TMDO_Live_Fixtures::flat( 'user', $uid, 'wp_persisted_preferences' ), 'flat wp_persisted_preferences' ); tmdo_live_assert_same( serialize( $loc ), TMDO_Live_Fixtures::flat( 'user', $uid, 'community-events-location' ), 'flat community-events-location' ); } ); TMDO_Live::test( 'backfill: native array meta is flattened serialized, not "Array"', static function () { TMDO_Live_Fixtures::field( 'user', 'community-events-location' ); TMDO_Live_Fixtures::use_modes( array( 'user' => 'disabled' ) ); $uid = TMDO_Live_Fixtures::user(); $loc = array( 'ip' => '198.51.100.0' ); update_user_meta( $uid, 'community-events-location', $loc ); tmdo_live_assert_same( array( serialize( $loc ) ), TMDO_Live_Fixtures::native( 'user', $uid, 'community-events-location' ), 'native precondition' ); $field = TMDO_Entity_Registry::get_field( 'user', 'community-events-location' ); TMDO_Entity_Migration_Engine::reset_checkpoint( 'user', $field['group'] ); TMDO_Entity_Migration_Engine::migrate_group( 'user', $field['group'], array( 'sleep_ms' => 0, 'resume' => false ) ); tmdo_live_assert_same( serialize( $loc ), TMDO_Live_Fixtures::flat( 'user', $uid, 'community-events-location' ), 'flat after backfill' ); } ); TMDO_Live::test( 'read path: from_db returns the array, not a serialized string', static function () { $field = TMDO_Live_Fixtures::field( 'user', 'wp_persisted_preferences' ); $prefs = array( 'core/edit-post' => array( 'panels' => array( 'a', 'b' ) ) ); $stored = TMDO_Type_Caster::to_db( $prefs, $field ); tmdo_live_assert_same( $prefs, TMDO_Type_Caster::from_db( $stored, $field ), 'round trip' ); } );