vendredi 16 décembre 2016

Testing non OOP PHP

I want to ask is there any way to test procedural code with unit test or any other way.

For example I have below very simple code:

$a = 10;
$b = 20;

for($i = $a; $i < $b; $i++){
    echo 'Loop ' . $i . PHP_EOL;
}

I know that I can check with isset() and other build in functions if the variable exists, also can check type of variable, with output buffering I can get output and count how many times loop was executed, but...can I check if there is for loop not while loop?

I can get whole php file and with regex found it, but maybe there is some kind of magic function that show me that.

Aucun commentaire:

Enregistrer un commentaire