My last article was part of a short series on automating local WordPress site setup. In that series, we created a WP-CLI package that helps with installing and uninstalling WordPress development environments, and we even got it submitted to the WP-CLI Package Index. Since the command is available for anyone to use in the Package Index, it makes sense to improve on the command and make sure that it works for everyone. In this post we’re going to take a bit of a break from automating WordPress installs and start writing some functional tests to make sure that everything works as expected. While I’ll be writing the tests for the wp installer command, the same concepts should apply for any WP-CLI package.
Functional Tests? You mean Unit Tests?
You’ve probably heard of unit testing and tools like PHPUnit. Unit tests are a great way to test specific functions or methods in your projects, and focus more on the code side of things.
Functional tests are similar to unit tests, but differ in that instead of writing code to verify that your existing code works properly, you describe how you expect a specific feature to behave in human-readable terms. This can be done using a language
Source: https://managewp.org/articles/14118/writing-functional-tests-for-wp-cli-packages
source https://williechiu40.wordpress.com/2017/01/03/writing-functional-tests-for-wp-cli-packages/
No comments:
Post a Comment