Testing Laravel with Pest
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 Pest as the tool to run your tests. Like Laravel, Pest tries to make it very easy for developers to get things done. Pest is not the most popular tool to run tests, but it is picking up speed fast. We can imagine Pest becoming the default test runner for Laravel in the future.
The current test runner for Laravel is PHPUnit. After you have a bit of experience with testing, you'll see that writing tests in PHPUnit is not that different from Pest. Though the syntax is a bit different, the ideas behind the tests are much the same. If you would prefer learning how to test using PHPUnit, check out the PHPUnit flavour of this course.
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