mardi 22 décembre 2015

How to test a method which calls itself?

Given this code:

function testMe($a)
{
    if ($a)
    {
        return 1;
    }
    else
    {
        return $this->testMe(true);
    }
}

testMe() cannot be mocked, because then I cant call it. On the other hand, it must be mocked…

Aucun commentaire:

Enregistrer un commentaire