Learn the pattern of writing software using TDD. Learn to follow the practice of first writing a failing test, next passing the test, and finally ensuring the code matches the specifications.
- [Instructor] So we've learned some of the basics…of writing unit tests and working using TDD.…I now want to cover making the test-driven…development pattern explicit,…and demonstrate the power that this pattern provides you.…We've already used this pattern throughout this course.…We write a test or modify a test…to get the test into a failed state.…We then write code to get our test passing again.…Let's explore that pattern in more detail now.…Let's say we wanted to add a new feature…to our Receipt class.…
This time we want to add a method to ensure…that the float values produced…are valid two-digit floats…and we always have them casted to as such.…In this case, we want to ensure that when we have one,…we always get 1.00,…or when we have 1.1, we always get 1.10,…or correspondingly, if we have 1.111,…i.e., three ones after the decimal place,…we only get back 1.11.…To do so, we'll open up our test class first.…
Our test class is in our editor…and available at tests, ReceiptTest.php.…And at the bottom, we'll add a new test method.…
- Why use unit testing?
- Writing unit tests
- Extending unit tests
- Filtering PHPUnit tests
- Building dummy objects
- Working with data providers
- Writing an exception-based test
- Using TDD tactics
- Using PHPUnit advanced tactics, such as database tests
Skill Level Intermediate
Managing PHP Persistent Sessionswith David Powers2h 41m Intermediate
1. The Basics of Test-Driven Development
2. Advanced Test-Driven Development
3. Test-Driven Development Tactics
4. PHPUnit Advanced Tactics
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.