Here’s my new tutorial I would like to share with you all is Setting up PHP Unit Testing For WordPress Plugins and Laravel.
What is Unit Testing and PHPUnit?
PHPUnit is a framework independent library for unit testing PHP.
Unit testing is a method by which small units of code are tested against expected results. Unit Testing helps to reduce such types of bugs. PHPUnit saves a lot of development time for developers because by writing unit tests, our code becomes less prone to defects.
I started using PHPUnit for my personal projects for both WordPress plugins and Laravel. I am no expert in Unit Testing but I am going to share with you guys how easy it is to install on your WP and Laravel Projects.
– I am currently using Homestead/Vagrant. It will also work with Docker and MAMP
– PHP 7 +
– WP CLI for WordPress
– Laravel and/or WordPress
composer require --dev phpunit/phpunit ^7
Let me know if you have any questions or feedback on this tutorial.
Up Next: Test-Driven Design in Laravel Framework
Leave a Reply