Comments (5)
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 duringtearDown()
.
from field-block-for-acf-pro.
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.
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.
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.
Content tests to be added: Image, File, WYSIWYG Editor, oEmbed, Gallery
from field-block-for-acf-pro.
Related Issues (20)
- Cater for fields with no value
- Google Chrome autocompleting Email and Password fields HOT 1
- Cater for field type `clone` HOT 1
- Cater for field type `google_map` HOT 2
- Internationalize and localize acf-field-block HOT 1
- Ensure ACF field block output supports different settings of the `align` attribute
- Checkbox rendering not working after cloning HOT 2
- Taxonomy rendering not working after cloning HOT 1
- Cater for duplicate field names with different keys HOT 5
- Cater for Inactive groups HOT 1
- Rename acf-field-block to Field block for ACF PRO - permalink: field-block-for-acf-pro HOT 2
- Support for PHP 8.1 and PHP 8.2 HOT 1
- Update documentation since the blocks have the wrong field name in the editor HOT 2
- Improve plugin to satisfy wordpress.org requirements HOT 1
- Add option to display the field's label HOT 1
- Sort field names by title and improve field identification if possible HOT 1
- Teething problems with v1.3.0 on s.b/cwiccer HOT 8
- Get values from options page
- Add support for the icon picker field type
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from field-block-for-acf-pro.