@@ -56,6 +56,45 @@ public function test_migrate_actor_mode() {
56
56
}
57
57
58
58
public function test_migrate_to_4_1_0 () {
59
+ $ post1 = \wp_insert_post (
60
+ array (
61
+ 'post_author ' => 1 ,
62
+ 'post_content ' => 'activitypub_content_visibility test ' ,
63
+ )
64
+ );
65
+
66
+ $ post2 = \wp_insert_post (
67
+ array (
68
+ 'post_author ' => 1 ,
69
+ 'post_content ' => 'activitypub_content_visibility test ' ,
70
+ )
71
+ );
72
+
73
+ \update_post_meta ( $ post1 , 'activitypub_content_visibility ' , '' );
74
+ \update_post_meta ( $ post1 , 'activitypub_content_123 ' , '456 ' );
75
+ \update_post_meta ( $ post2 , 'activitypub_content_visibility ' , 'local ' );
76
+ \update_post_meta ( $ post2 , 'activitypub_content_123 ' , '' );
77
+
78
+ $ metas1 = \get_post_meta ( $ post1 );
79
+
80
+ $ this ->assertEquals (
81
+ array (
82
+ 'activitypub_content_visibility ' => array ( '' ),
83
+ 'activitypub_content_123 ' => array ( '456 ' ),
84
+ ),
85
+ $ metas1
86
+ );
87
+
88
+ $ metas2 = \get_post_meta ( $ post2 );
89
+
90
+ $ this ->assertEquals (
91
+ array (
92
+ 'activitypub_content_visibility ' => array ( 'local ' ),
93
+ 'activitypub_content_123 ' => array ( '' ),
94
+ ),
95
+ $ metas2
96
+ );
97
+
59
98
$ template = \get_option ( 'activitypub_custom_post_content ' , ACTIVITYPUB_CUSTOM_POST_CONTENT );
60
99
$ object_type = \get_option ( 'activitypub_object_type ' , ACTIVITYPUB_DEFAULT_OBJECT_TYPE );
61
100
@@ -66,6 +105,25 @@ public function test_migrate_to_4_1_0() {
66
105
67
106
\Activitypub \Migration::migrate_to_4_1_0 ();
68
107
108
+ \clean_post_cache ( $ post1 );
109
+ $ metas1 = \get_post_meta ( $ post1 );
110
+ $ this ->assertEquals (
111
+ array (
112
+ 'activitypub_content_123 ' => array ( '456 ' ),
113
+ ),
114
+ $ metas1
115
+ );
116
+
117
+ \clean_post_cache ( $ post2 );
118
+ $ metas2 = \get_post_meta ( $ post2 );
119
+ $ this ->assertEquals (
120
+ array (
121
+ 'activitypub_content_visibility ' => array ( 'local ' ),
122
+ 'activitypub_content_123 ' => array ( '' ),
123
+ ),
124
+ $ metas2
125
+ );
126
+
69
127
$ template = \get_option ( 'activitypub_custom_post_content ' );
70
128
$ content_type = \get_option ( 'activitypub_post_content_type ' );
71
129
$ object_type = \get_option ( 'activitypub_object_type ' );
0 commit comments