Povilas Korop – Laravel – PHPUnit Testing for Beginners
Automated testing is a crucial part of any long-term IT project. But often developers don’t have time for that – budgets and deadlines are tight, and clients want to launch features quickly.
As a result, a lot of developers never actually testing, because they don’t have projects with time/budget to afford this “luxury”. Also it seems that PHPUnit and “100% Test Coverage” are really complicated.
In reality, automated testing is pretty simple – and I will prove it to you in this course.
To testing simple functionality, it’s enough to invest a few hours and you will adapt the mindset, with basic examples.
Throughout this course, we will create a mini-application for Products CRUD, and with every page I will show you different details of automated testing:
– Testing that some text is on the page
– Testing that some data is correctly added/updated/deleted
– Testing that correct validation was actually fired
– Testing that only authenticated users access the data
– etc.
Finally, in the last lesson I will show you a TDD approach to write tests, with test written before the actual application.
So, let’s dive in?
Your Instructor
Povilas Korop
Povilas Korop
I consider myself a Laravel expert. Work with Laravel around 6 years, I also write about it on my Laravel Daily Blog
Active contributor to official Laravel News blog, latest article: 20 Laravel Eloquent Tips and Tricks
Also sharing my thoughts on YouTube channel “Laravel Business”: https://www.youtube.com/channel/UCTuplgOBi6tJIlesI…
Course Curriculum
List of Lessons (~90 Minutes Total)
Intro: WHY do you need to (automatically) test your code? (2:11)
Our First Test: How PHPUnit works? What is Test and Assertion? (4:45)
Real project “Product List”: Testing that table is (not) empty (5:45)
Database Configuration: RefreshDatabase, Phpunit.xml and .env.testing (7:27)
Be careful with assertSee: test DATA to avoid false positives (3:07)
Unit Tests vs Feature Tests: example of currency converter (9:32)
Factories: How to create many testing records without loops (6:43)
Auth Test: Does user have access to the page? (10:13)
Avoid creating the same data: Private methods or setUp() (4:20)
Testing roles: only Admin can access creating products (6:49)
New Product: testing that record was saved into database (4:17)
Edit Product: Testing correct values in form inputs (3:27)
Update Product: test if validation error is fired correctly (4:47)
Delete Product: test if it’s actually removed from database (3:00)
Testing file uploads: fake storage driver (4:54)
PHPUnit Flags: run only the tests you’re interested in (3:16)
Test Driven Development: simple TDD example (7:28)
Frequently Asked Questions
Reviews
There are no reviews yet.