mercredi 31 mars 2021

Write a unit test class for an existing function that requires mockup within the function

I have a bunch of PHP functions that require unit test classes to be written. I just want to know is there any way to mock-up lines of a function before use assertions?

<?php 

function get_Func($args){
    $number = $args[0];
    $id = "71"+$args[1]+"0";

//The Line I need to mockup without touching the code
    $result = getViaCurl($number,$id);

    return $result;
}

?>

Aucun commentaire:

Enregistrer un commentaire