mercredi 29 avril 2015

Unit Testing a PHP Script

I have some php scripts that are run as cronjobs. No classes and only a few functions.

Id like to test the script with PHPUnit to make sure everything is working but it appears I need to rewrite the php as a class, which I dont want to do (or know how to).

For example if I had a script and its only function was to add 1 and 2 together,

 <?php

 $a=1;
 $b=2
 $c=$a+$b;

 ?>

how do I test that $c==3 with phpunit?

Thanks, Don

Aucun commentaire:

Enregistrer un commentaire