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.
composer require niels-de-blaauw/wp-qualitycontrol
The tool will load automatically.
Inside WordPress install, use the generate command:
wp qualitycontrol generate
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.
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.
There are three filters to hijack the field object.
add_filter('ndb/qualitycontrol/field_name=post_option_name', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
add_filter('ndb/qualitycontrol/field_key=field_597c8fd614621', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
add_filter('ndb/qualitycontrol/field_type=color_picker', function($returnValue, $field, $post_type){
return new CustomObject($field, $post_type);
}, 10, 3);
Returning false
skips to the next filter. Otherwise you must return
an object implementing \NDB\QualityControl\FieldTypes\iFieldType
.
- 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
.