Automated Testing with PHPUnit. How do you know your code works?. Manual Testing. Type in a value Submit the form Check by eye. Manual Testing. Tedious Time Consuming Error Prone Did you test everything? Consistently?. Automated Testing. Have the computer run your tests.
Automated Testing with PHPUnit
Have the computer run your tests
Know that your code does what it needs to
Know that your code doesn’t break anything that used to work
Automated testing one unit at a time
Module (procedural programming)
Code that makes executing tests simple
Often a command-line tool
(useable by IDE)
Test Driven Development (TDD)
How should your code work?
What do the requirements mean?
Do The Simplest Thing That Could Possibly Work
Know when you’re done: All tests are green.
Tests become biased for the code you already wrote