Introduction to TDD with PHPUnit

Introduction to TDD with PHPUnit

emanuel.feruzi

Senior Member
Joined
Apr 25, 2009
Posts
103
Reaction score
8
Hi,

I have been working on a small tool called kiGM for the ANLoc initiative and as I wanted to know how it will behave in different scenarios. There is no better way to do that than to use Test Driven Development. So after a few how of programming I thought someone might be wondering how to do TDD on PHP. So I blogged it with a very simple example.

An Extract from the Post:

TDD Example with PHP
There are many ways in which one can implement a TDD. In this example, we will create a simple calculator with the four basic operations that is (add, subtract, multiply and divide).
But after looking around and looking back to my exprience, it looks like there is one way that most developers agree on:-
  • design your class/API
  • create a test suite
  • run the test, and in this case all tests should fail
  • implement the class
  • run the test, an this time some test will pass and some will fail
  • fix failures or errors
  • repeat 5 and 6 till all tests have passed

Lets get to it......

Read and get complete source code.
 
Back
Top Bottom