Laravel Testing For Beginners: PHPUnit, Pest, TDD
August 2022 / 2 h 05 min / Laravel 9
Watch Video About the Course
IMPORTANT NOTICE: Since September 2022, I'm moving from this Teachable platform to my own LaravelDaily.com with this course and even more premium tutorials there. So, please subscribe to yearly/monthly membership there, this Teachable platform will not get new content anymore.
With any questions about the membership, email me [email protected]
If you want to get a serious developer job, you are usually required to write automated tests. Here are a few job examples:
So if you haven't started yet, this course is for you: I will give you practical examples, and explain the theory along the way.
We will talk about:
- How to setup and run tests in Laravel
- Difference between Feature and Unit tests
- How to test authentication/authorization
- How to use Factories to fake data
- How to test APIs and JSON
- How to use PEST for testing
- TDD approach, including my own opinion about it
- ... and more.
Links to the Github repository are included, so you will be able to easily follow along the practical scenarios.
So, let's dive into the course?
Your Instructor
I consider myself a Laravel expert. Work with Laravel for around 7 years, sharing my thoughts on the YouTube channel "Laravel Daily": https://www.youtube.com/c/LaravelDaily
I also have written a Laravel Daily Blog for 5+ years.
Course Curriculum
-
StartOur First Test: Products Table - Empty or Not? (4:58)
-
StartDatabase Configuration: RefreshDatabase, Phpunit.xml and .env.testing (5:05)
-
StartAAA "Mantra": Arrange, Act, Assert (1:56)
-
StartBe careful with assertSee: test DATA to avoid false positives (3:47)
-
StartUnit Tests vs Feature Tests: example of currency converter (5:40)
-
StartFactories: How to create many testing records without loops (4:54)
-
StartAuth Test: Does user have access to the page? (6:56)
-
StartAvoid creating the same data: Private methods or setUp() (3:17)
-
StartTesting roles: only Admin can access creating products (7:48)
-
StartNew Product: testing that record was saved into database (4:59)
-
StartEdit Product: Testing correct values in form inputs (4:14)
-
StartUpdate Product: test if validation error is fired correctly (3:20)
-
StartDelete Product: test if it's actually removed from database (2:40)
-
StartTesting APIs and JSONs (5:42)
-
StartPhp artisan test Flags: Run Specific Test(s) (1:43)