get_fields doesn’t work as well with dummy data in phpunit
-
In unit tests I have the problem when use factory class of the unit test for create dummy data in test DB.
$id = $this->factory->post->create( [ 'post_title' => 'test_acf', 'post_name' => 'test_acf', ] ); add_post_meta( $id, 'my_key1', 1 ); add_post_meta( $id, 'my_key2', 2 ); add_post_meta( $id, 'my_key3', 3 );After that we can get post meta with
get_post_meta($id, 'my_key1');
Butget_fields($id);doesn’t works as well. It’s return just false.
The topic ‘get_fields doesn’t work as well with dummy data in phpunit’ is closed to new replies.