@@ -63,13 +63,13 @@ public function test_reciprocal_meta() {
63
63
$ this ->assertEquals ( $ this ->author , get_post_meta ( $ this ->post ->ID , 'test_reciprocal ' , true ) );
64
64
$ this ->assertEquals ( $ this ->post ->ID , get_user_meta ( $ this ->author , 'reciprocal_post ' , true ) );
65
65
}
66
-
66
+
67
67
/**
68
68
* Test that various store properties work
69
69
*/
70
70
public function test_store_properties () {
71
71
$ user = get_userdata ( $ this ->author );
72
-
72
+
73
73
$ store_id = new Fieldmanager_Autocomplete ( array (
74
74
'name ' => 'test_store_id ' ,
75
75
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -79,7 +79,7 @@ public function test_store_properties() {
79
79
80
80
$ this ->save_values ( $ store_id , $ this ->post , $ user ->ID );
81
81
$ this ->assertEquals ( $ user ->ID , get_post_meta ( $ this ->post ->ID , 'test_store_id ' , true ) );
82
-
82
+
83
83
$ store_user_login = new Fieldmanager_Autocomplete ( array (
84
84
'name ' => 'test_store_user_login ' ,
85
85
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -89,7 +89,7 @@ public function test_store_properties() {
89
89
90
90
$ this ->save_values ( $ store_user_login , $ this ->post , $ user ->user_login );
91
91
$ this ->assertEquals ( $ user ->user_login , get_post_meta ( $ this ->post ->ID , 'test_store_user_login ' , true ) );
92
-
92
+
93
93
$ store_user_email = new Fieldmanager_Autocomplete ( array (
94
94
'name ' => 'test_store_user_email ' ,
95
95
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -99,7 +99,7 @@ public function test_store_properties() {
99
99
100
100
$ this ->save_values ( $ store_user_email , $ this ->post , $ user ->user_email );
101
101
$ this ->assertEquals ( $ user ->user_email , get_post_meta ( $ this ->post ->ID , 'test_store_user_email ' , true ) );
102
-
102
+
103
103
$ store_user_nicename = new Fieldmanager_Autocomplete ( array (
104
104
'name ' => 'test_store_user_nicename ' ,
105
105
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -110,7 +110,7 @@ public function test_store_properties() {
110
110
$ this ->save_values ( $ store_user_nicename , $ this ->post , $ user ->user_nicename );
111
111
$ this ->assertEquals ( $ user ->user_nicename , get_post_meta ( $ this ->post ->ID , 'test_store_user_nicename ' , true ) );
112
112
}
113
-
113
+
114
114
/**
115
115
* Test creating a field with an invalid store property.
116
116
* @expectedException FM_Developer_Exception
@@ -125,7 +125,7 @@ public function test_save_invalid_store_property() {
125
125
126
126
$ this ->save_values ( $ test_invalid , $ this ->post , $ this ->author );
127
127
}
128
-
128
+
129
129
/**
130
130
* Test creating a field with an invalid display property.
131
131
* @expectedException FM_Developer_Exception
@@ -140,7 +140,7 @@ public function test_save_invalid_display_property() {
140
140
141
141
$ this ->save_values ( $ test_invalid , $ this ->post , $ this ->author );
142
142
}
143
-
143
+
144
144
/**
145
145
* Test that we fail when trying to use reciprocals with something other than ID as a store property.
146
146
* @expectedException FM_Developer_Exception
@@ -156,32 +156,32 @@ public function test_save_invalid_reciprocal() {
156
156
157
157
$ this ->save_values ( $ test_invalid , $ this ->post , $ this ->author );
158
158
}
159
-
159
+
160
160
/**
161
161
* Test that this fails when a user doesn't have permission to list users.
162
162
* @expectedException WPDieException
163
163
*/
164
164
public function test_save_permissions () {
165
165
wp_set_current_user ( $ this ->author );
166
-
166
+
167
167
$ test_invalid = new Fieldmanager_Autocomplete ( array (
168
168
'name ' => 'test_invalid ' ,
169
169
'datasource ' => new Fieldmanager_Datasource_User (),
170
170
) );
171
-
171
+
172
172
$ this ->save_values ( $ test_invalid , $ this ->post , $ this ->editor );
173
-
173
+
174
174
wp_set_current_user ( $ this ->author );
175
175
176
176
$ this ->save_values ( $ test_invalid , $ this ->post , $ this ->editor );
177
177
}
178
-
178
+
179
179
/**
180
180
* Test that display property returns the correct value in all reasonable cases.
181
181
*/
182
182
public function test_display_properties () {
183
183
$ user = get_userdata ( $ this ->author );
184
-
184
+
185
185
$ test_display_name = new Fieldmanager_Autocomplete ( array (
186
186
'name ' => 'test_display_name ' ,
187
187
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -191,7 +191,7 @@ public function test_display_properties() {
191
191
192
192
$ test_users_display_name = $ test_display_name ->datasource ->get_items ( $ user ->user_login );
193
193
$ this ->assertEquals ( $ user ->display_name , $ test_users_display_name [ $ user ->ID ] );
194
-
194
+
195
195
$ test_user_login = new Fieldmanager_Autocomplete ( array (
196
196
'name ' => 'test_user_login ' ,
197
197
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -201,7 +201,7 @@ public function test_display_properties() {
201
201
202
202
$ test_users_user_login = $ test_user_login ->datasource ->get_items ( $ user ->user_login );
203
203
$ this ->assertEquals ( $ user ->user_login , $ test_users_user_login [ $ user ->ID ] );
204
-
204
+
205
205
$ test_user_email = new Fieldmanager_Autocomplete ( array (
206
206
'name ' => 'test_user_email ' ,
207
207
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -211,7 +211,7 @@ public function test_display_properties() {
211
211
212
212
$ test_users_user_email = $ test_user_email ->datasource ->get_items ( $ user ->user_login );
213
213
$ this ->assertEquals ( $ user ->user_email , $ test_users_user_email [ $ user ->ID ] );
214
-
214
+
215
215
$ test_user_nicename = new Fieldmanager_Autocomplete ( array (
216
216
'name ' => 'test_user_nicename ' ,
217
217
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -222,13 +222,13 @@ public function test_display_properties() {
222
222
$ test_users_user_nicename = $ test_user_nicename ->datasource ->get_items ( $ user ->user_login );
223
223
$ this ->assertEquals ( $ user ->user_nicename , $ test_users_user_nicename [ $ user ->ID ] );
224
224
}
225
-
225
+
226
226
/**
227
227
* Test that store property returns the correct display value in all reasonable cases.
228
228
*/
229
229
public function test_store_property_display () {
230
230
$ user = get_userdata ( $ this ->author );
231
-
231
+
232
232
$ test_id = new Fieldmanager_Autocomplete ( array (
233
233
'name ' => 'test_display_name ' ,
234
234
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -239,7 +239,7 @@ public function test_store_property_display() {
239
239
$ test_users_id = $ test_id ->datasource ->get_items ( $ user ->user_login );
240
240
$ this ->assertEquals ( $ user ->display_name , $ test_users_id [ $ user ->ID ] );
241
241
$ this ->assertEquals ( $ user ->display_name , $ test_id ->datasource ->get_value ( $ user ->ID ) );
242
-
242
+
243
243
$ test_user_login = new Fieldmanager_Autocomplete ( array (
244
244
'name ' => 'test_user_login ' ,
245
245
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -250,7 +250,7 @@ public function test_store_property_display() {
250
250
$ test_users_user_login = $ test_user_login ->datasource ->get_items ( $ user ->user_login );
251
251
$ this ->assertEquals ( $ user ->display_name , $ test_users_user_login [ $ user ->user_login ] );
252
252
$ this ->assertEquals ( $ user ->display_name , $ test_user_login ->datasource ->get_value ( $ user ->user_login ) );
253
-
253
+
254
254
$ test_user_email = new Fieldmanager_Autocomplete ( array (
255
255
'name ' => 'test_user_email ' ,
256
256
'datasource ' => new Fieldmanager_Datasource_User ( array (
@@ -261,7 +261,7 @@ public function test_store_property_display() {
261
261
$ test_users_user_email = $ test_user_email ->datasource ->get_items ( $ user ->user_login );
262
262
$ this ->assertEquals ( $ user ->display_name , $ test_users_user_email [ $ user ->user_email ] );
263
263
$ this ->assertEquals ( $ user ->display_name , $ test_user_email ->datasource ->get_value ( $ user ->user_email ) );
264
-
264
+
265
265
$ test_user_nicename = new Fieldmanager_Autocomplete ( array (
266
266
'name ' => 'test_user_nicename ' ,
267
267
'datasource ' => new Fieldmanager_Datasource_User ( array (
0 commit comments