RELEASE NAME....: LaravelDaily.Laravel.PHPUnit.Testing.for.Beginners-ELOHiM
RELEASE DATE....: 2019-09-25
RELEASE SIZE....: 30x50Mb
FORMAT..........: Bookware
LANGUAGE........: English
URL.............: https://laraveldaily.teachable.com/p/laravel-phpunit-testing-for-beginners
https://github.com/LaravelDaily/Laravel-PHPUnit-Beginners-Course
Intro: WHY do you need to (automatically) test your code?
Our First Test: How PHPUnit works? What is Test and Assertion?
Real project "Product List": Testing that table is (not) empty
Database Configuration: RefreshDatabase, Phpunit.xml and .env.testing
Be careful with assertSee: test DATA to avoid false positives
Unit Tests vs Feature Tests: example of currency converter
Factories: How to create many testing records without loops
Auth Test: Does user have access to the page?
Avoid creating the same data: Private methods or setUp()
Testing roles: only Admin can access creating products
New Product: testing that record was saved into database
Edit Product: Testing correct values in form inputs
Update Product: test if validation error is fired correctly
Delete Product: test if it's actually removed from database
Testing file uploads: fake storage driver
PHPUnit Flags: run only the tests you're interested in
Test Driven Development: simple TDD example
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 start 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 start 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?