Variations

What happens when you have two tests with slightly different setups? There are two possibilities:

  • If the setUp( ) code differs only slightly, move the code that differs from the setUp( ) code to the test method.

  • If you really have a different setUp( ), you need a different test-case class. Name the class after the difference in the setup.

Get PHPUnit Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.