jeudi 20 août 2015

How to add Unit Test cases for PHP without any classes or functions?

I have a php code which looks something like this. It is accepting the values from another php page using the POST methods. It does few calculations and redirects to another page with the calculated data.

<?php $x=$_POST['param1]; $y=$_POST['param2']; $z= $x+$y header("location:index.php?msg=".$z ?>

How do you unit test these kind of php blocks? For all the documentations I have tried to Google, all of the php codes had classes and functions in it.

I would not want to rewrite the code using class or function. Any help would be appreciated.

Aucun commentaire:

Enregistrer un commentaire