theme-check
theme-check copied to clipboard
Add Unit Tests
It'd be great if there were unit tests available that had examples of all the bad code that these checks are trying to pick up.
Right now, its hard to know that if changing a check is going to cause some code to pass by, or in some cases, what it's even trying to detect.
To me this sounds a bit like the PHPCS tests?
Would you mind elaborating what kind of tests you had in mind and how it differs from expanding https://github.com/WPTT/WPThemeReview/?
The intention was Unit tests for the checks the plugin has. You can think of the Theme Check checks as tests for themes, but those tests are lacking reproducible tests for themselves, which has lead to a bunch of bugs (some of which you'll see I've fixed recently)
The PHPCS rules do have a set of tests for them: https://github.com/WPTT/WPThemeReview/tree/develop/WPThemeReview/Tests
Basically providing an example for each rule that the plugin attempts to cover, and to ensure that future changes of the plugin do not fail to cover it, while also automating those checks so that they happen on each PR/commit. It also allows for switches to other mechanisms, PHPCS for example, to be verified against the existing tests to verify that they adequately cover the same things.
While I am always for having tests in the apps that are running on huge systems, wouldn't it be better to focus on wpthemereview sniffs? That way you can use them for a lot of things theme check checks, and leave theme check or sniffer for the rest