@@ -242,8 +242,7 @@ public function test_alter_child_invalid_publish() {
242
242
* Test save_to_post_parent logic
243
243
*/
244
244
public function test_post_parent () {
245
- $ test_data = $ this ->child_post_a ->ID ;
246
- $ children = new Fieldmanager_Autocomplete ( array (
245
+ $ fm = new Fieldmanager_Autocomplete ( array (
247
246
'name ' => 'test_parent ' ,
248
247
'datasource ' => new Fieldmanager_Datasource_Post ( array (
249
248
'query_args ' => array (
@@ -252,18 +251,17 @@ public function test_post_parent() {
252
251
'save_to_post_parent ' => true ,
253
252
) ),
254
253
) );
255
- $ this ->save_values ( $ children , $ this ->parent_post , $ test_data );
256
- $ parent = get_post ( $ this ->parent_post ->ID );
257
- $ this ->assertEquals ( $ parent -> post_parent , $ this -> child_post_a -> ID );
258
- $ this ->assertEquals ( get_post_meta ( $ this ->parent_post ->ID , 'test_parent ' , true ), $ this -> child_post_a -> ID );
254
+ $ this ->save_values ( $ fm , $ this ->child_post_a , $ this -> parent_post -> ID );
255
+ $ child = get_post ( $ this ->child_post_a ->ID );
256
+ $ this ->assertEquals ( $ this -> parent_post -> ID , $ child -> post_parent );
257
+ $ this ->assertEquals ( $ this -> parent_post -> ID , get_post_meta ( $ this ->child_post_a ->ID , 'test_parent ' , true ) );
259
258
}
260
259
261
260
/**
262
261
* Test save_to_post_parent logic
263
262
*/
264
263
public function test_post_parent_nested () {
265
- $ test_data = array ( 'parent ' => $ this ->child_post_a ->ID );
266
- $ children = new Fieldmanager_Group ( array (
264
+ $ fm = new Fieldmanager_Group ( array (
267
265
'name ' => 'test_parent ' ,
268
266
'children ' => array (
269
267
'parent ' => new Fieldmanager_Autocomplete ( 'Post Parent ' , array (
@@ -277,9 +275,10 @@ public function test_post_parent_nested() {
277
275
) ),
278
276
),
279
277
) );
280
- $ this ->save_values ( $ children , $ this ->parent_post , $ test_data );
281
- $ parent = get_post ( $ this ->parent_post ->ID );
282
- $ this ->assertEquals ( $ parent ->post_parent , $ this ->child_post_a ->ID );
278
+ $ this ->save_values ( $ fm , $ this ->child_post_a , array ( 'parent ' => $ this ->parent_post ->ID ) );
279
+ $ child = get_post ( $ this ->child_post_a ->ID );
280
+ $ this ->assertEquals ( $ this ->parent_post ->ID , $ child ->post_parent );
281
+ $ this ->assertEquals ( '' , get_post_meta ( $ this ->child_post_a ->ID , 'test_parent ' , true ) );
283
282
}
284
283
285
284
/**
0 commit comments