Support » Plugin: Advanced Custom Fields » 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');
    But get_fields($id); doesn’t works as well. It’s return just false.

  • You must be logged in to reply to this topic.