Giter Site home page Giter Site logo

Comments (5)

bobbingwide avatar bobbingwide commented on July 20, 2024

I've had some difficulty creating a framework for the PHPUnit tests.
Rather than dynamically creating the field groups and fields I've had to resort to defining a set of field groups for a new CPT called test-acf-fields.
And then I had difficulty getting more than one test to run.

The call to get_field('acf-field-name'); fails in the second test case.

This is because, during the method tearDown(), in class WP_UnitTestCase, in oik-batch\tests\testcase.php, the WordPress test suite resets the hooks that ACF has added. This removes the filter function for acf/pre_load_post_id which is needed to determine the value of the acf-field-name from the block's attributes.

Workaround

  • Change tearDown() to not call _restore_hooks()

Longer term solution

  • Allow the test case to determine whether or not _restore_hooks() is run during tearDown().

from field-block-for-acf-pro.

bobbingwide avatar bobbingwide commented on July 20, 2024

I have to resort to defining a set of field groups for a new CPT called test-acf-fields.

To do this I imported the acf-json from the original theme 'genesis-oik', to the active theme 'Fizzie',
and changed the Location Rules to this CPT.

This works for the s.b/wordpress environment, but not for others such as s.b/oikcom, where the block examples are documented.

It would make sense for these .json files to be stored in the tests\acf-json subdirectory so that they could be loaded into other environments. In which case they may as well support both CPTs test-acf-fields and block_examples.

from field-block-for-acf-pro.

bobbingwide avatar bobbingwide commented on July 20, 2024

So far I've added tests for 5 field types. These have been tested with PHP 8.1 and PHP 8.2
Further tests need adding for the other field types
plus some pre-requisite tests such as confirming that Advanced Custom Fields PRO is activated.

from field-block-for-acf-pro.

bobbingwide avatar bobbingwide commented on July 20, 2024

So far I've added tests for 5 field types.

Actually 6 - text, text-area, number, range, email, url

This one to do for the basic field types: password.

Then for the rest see the table of field types supported in https://www.oik-plugins.com/oik-plugins/field-block-for-acf-pro/

from field-block-for-acf-pro.

bobbingwide avatar bobbingwide commented on July 20, 2024

Content tests to be added: Image, File, WYSIWYG Editor, oEmbed, Gallery

from field-block-for-acf-pro.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.