Learn some advanced measures that code coverage generates for our code as well as how to read the different metrics generated by the coverage reports to improve both your unit tests and your software, in general.
- [Instructor] The Code Coverage report…that we looked at in the prior video…gives us tools to better design and develop our tests.…Look now at the coverage report for the Receipt class.…This coverage report gives us the same basic information…that we had beforehand.…Let's now observe what happens…when we make changes into our test class.…First, we'll open up our editor,…and open up ReceiptTest.php,…which may be found in our Test directory.…Now, let's disable the test for the tax method.…
To do so, we'll scroll down…and we'll comment out lines 91 through 82.…We'll save this, and we'll rerun our test…with $vendor/bin/phpunit.…Now if we go back to our Receipt coverage report…and refresh,…we'll see a few things.…First we no longer have coverage on the tax method,…so we both lost our 100% coverage score…and our CRAP score rose for both…that particular method and for the class in general.…
Let's try something else.…Go back to our ReceiptTest class,…and let's comment out generating the mock…on lines 66 through 77.…Now, because we used some fake numbers in our test…
- 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.