https://github.com/nielsdeblaauw/wp-qualitycontrol
Allows for automated testing of the various inputs possible with ACF fields.
https://github.com/nielsdeblaauw/wp-qualitycontrol
acf-field automated-testing wordpress wordpress-development wp-qualitycontrol
Last synced: about 1 year ago
JSON representation
Allows for automated testing of the various inputs possible with ACF fields.
- Host: GitHub
- URL: https://github.com/nielsdeblaauw/wp-qualitycontrol
- Owner: NielsdeBlaauw
- License: mit
- Created: 2017-12-23T13:00:30.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-11T06:30:35.000Z (about 8 years ago)
- Last Synced: 2025-03-24T14:41:49.660Z (over 1 year ago)
- Topics: acf-field, automated-testing, wordpress, wordpress-development, wp-qualitycontrol
- Language: PHP
- Size: 85 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://www.codefactor.io/repository/github/nielsdeblaauw/wp-qualitycontrol/overview/master)
# WP Qualitycontrol
With complex themes it is often impossible to try every single combination
of settings and fields provided in post-types.
WP Qualitycontrol creates many fuzzed posts with minimal configuration. After
generating semi-realistic content the created posts are tested to see if they
produce a valid webpage.
# Setup
## 1. Define WP Qualitycontrol as a dependency
`composer require niels-de-blaauw/wp-qualitycontrol`
The tool will load automatically.
## 2. Run the generate command
Inside WordPress install, use the generate command:
`wp qualitycontrol generate`
# Customisation
It is possible to overwrite and extend the field processing with custom
classes. This method can be used to add non-standard ACF field types, or
modify output generation when the default does not fit the project.
## Tests
You can add tests to the URL validation by using the following filters:
- `ndb/qualitycontrol/test/fulfilled` possibly succeeded.
- `ndb/qualitycontrol/test/rejected` probably failed.
## Fields
There are three filters to hijack the field object.
### 1. Field name
```
add_filter('ndb/qualitycontrol/field_name=post_option_name', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
```
### 2. Field key
```
add_filter('ndb/qualitycontrol/field_key=field_597c8fd614621', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
```
### 3. Field type
```
add_filter('ndb/qualitycontrol/field_type=color_picker', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
```
## Return value
Returning `false` skips to the next filter. Otherwise you must return
an object implementing `\NDB\QualityControl\FieldTypes\iFieldType`.
# Notes
- The generate command will clean generated posts before and after running
the command, unless you tell it not to.
- If the testing sequence is enabled and fails, cleaning the generated posts
is skipped so you can debug with the generated content that failed.
- You can manually clean generated posts with `wp qualitycontrol clean`.