O'Reilly logo

PHPUnit Essentials by Zdenek Machek

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

DBUnit

DBUnit is a PHPUnit extension that makes our integration testing easier. DBUnit allows you to clear the database and import a prepared dataset to set the database to a known state. This is important for database testing. If you set up a test database and allow data to be stored there without cleaning it, sooner or later you will have negative fails, and your test will be less reliable.

To make it clear, DBUnit helps with database testing, but it's not a magical tool that will solve all problems. You need to create and maintain your database's structure. In addition, you need to maintain datasets used for tests. I don't remember the last time I worked on a project that didn't use a database abstraction layer. When you use a database abstraction ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required