Testing Laravel with PHPUnit
Welcome to this course!
You are about to start your journey in the wonderful world of testing. We hope you're as excited about this as we are.
If you're completely new to testing, you've arrived at the right place. After just a few lessons, you will be able to automatically test the most important pieces of your application.
Even if you already have some experience with testing, this course will probably sharpen your skills.
Which test runner should you use?
In this course, you will use PHPUnit as the tool to run tests. It is the default testrunner for Laravel. The large majority of all Laravel projects have a test suite written for PHPUnit.
Recently, Pest, an alternative testrunner has been picking up speed. Though we can't look into the future, we can imagine this tool becoming the new default in a future version of Laravel. If you would prefer learning how to test using Pest, check out the Pest flavour of this course. Though the syntax is a bit different, the ideas behind the tests are much the same.
How you should follow this course
In this course we'll be using a blog demo application and add tests to it. You'll find the source code of the demo app in this repository on GitHub. The repo is marked as private. If you don't see it, make sure to connect your spatie.be account to GitHub on the profile page.
You can clone the repo, remove all the tests, and try adding the tests that we show in the videos. But what would be even better is that you try to add tests to an application of your own. In one of the first videos, we'll show you how to add a test to make sure that the homepage works. That would probably be a very good one for your app as well. When you see videos on how to add tests for models, try to add similar tests for the models in your app, and so on.
Laravel has excellent testing facilities. In the videos of this course, you'll see that you can write a test for almost any functionality. Of course, we can't show you every little function that Laravel provides. During the course, make sure to read the testing section of the Laravel docs.
We've put a lot of love in creating those videos, and we hope you'll enjoy them.
Brent & Freek