I have a project that uses ACF to generate fields in the pages, and I output those fields in my REST API responses.
I searched the net but it doesn’t seem to be a popular issue:
How do you mock the data for the created fields? I know that they are stored in the post meta, and I could just create a mock page with WP test factory, and then use update_field(), but I’d need the correct way to see what data should go in there based on my fields.
Is there an easy way to see this data and how it’s saved in the DB so that I can mock it in my test?
There isn’t any tool that I know of that will create dummy acf data. This one is good, but you need to create filters to insert content for ACF fields https://github.com/bordoni/fakerpress which means you’ve already gotta know how ACF stores data for each field.
Each field stores data in a different way, not all fields are special but it would still take pages to explain in all. Most fields simply store text values of the input.
I would say to create at least one post with the fields and then search the postmeta table for that post ID to see how it’s stored. Then if you don’t understand what you’re seeing for a specific field type to let me know and I’ll explain it.