Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Test case in PHPUnit


Having installed PHPUnit successfully, your challenge is not over yet—it has just led to another array of challenges. Testing is no easy task, but it is interesting. Just as you love writing beautiful PHP code, you will love writing test cases in PHPUnit because it is just like writing PHP code while taking care of some conventions.

A test case is a piece of an application that is written specifically to check (or test) for certain conditions in another application. Thus, when you write down a test case, you actually write a PHP code to test if something has gone wrong in other PHP code (which happens to be the code you have written to meet the business requirements).

Here, it is quite important to state that you, the programmer, usually have the following point of view:

  • You think that since you know your code very well you know that your code is errorless

  • Even if there are some errors in your code, since you know the code deeply, you can fix it in a flash

  • You think that...